Cn_Index ={
	init : function(){
		if(!Jes.userSess(1)) return;//session
		var uid =Jes.request('uid');
		userInfo.uid = uid || userInfo.userid;
		Jes('yq').value='http://www.cuniao.com/cuniao/cuniao/acl/register.html?userid='+userInfo.userid;
		var SDmodel = new scrollDoor();
		SDmodel.sd(["tab01","tab02"],["tdivs01","tdivs02"],"tabseled","tabnoseled");
		SDmodel.sd(["tab111","tab112","tab113"],["tdivs111","tdivs111","tdivs111"],"tabseled","tabnoseled","tabnoseled");
		this.queryUserInfo();//个人信息
		this.queryUserGroup();//用户分组
		this.queryTopic('all_topic');//默认显示全部
		this.synInfo();//根据用户来源显示用户信息
		Comm.rightRecommUser(null,null,'Cn_Index.aftergz();');//好友推荐
		Comm.rightRecommAct(null,'recommAct');//活动推荐
		Comm.officialAct();//官方活动
		Comm.queryhint();//提示信息
		Cn_Index.queryImpress(userInfo.userid);//好友评价
		//Comm.newestUser('newestuser');//最新注册用户
		//Comm.recentAct();//最新的活动
	//	Comm.officImgShow();//官方活动
	//	Cn_Index.createActInit();//发起活动的初始化
	}
	//首页TAB初始化
	,tab1Init : function(){
		this.queryUserGroup();//用户分组
		this.queryTopic('all_topic');//默认显示全部
		var SDmodel = new scrollDoor();
		SDmodel.sd(["tab01","tab02"],["tdivs01","tdivs02"],"tabseled","tabnoseled");
		Jes.Door.init('tab11',3);
	}
	//个人主页初始化
	,personInit : function(){
		var onLine = Jes.userSess();
		$('#tab11').addClass('tabseled');
		$('#tab12').removeClass('tabseled').addClass('tabnoseled');
		Jes.Door.init('tab11',3);
		this.queryUserInfo(uid);//个人信息
		this.queryTopic('all_topic',null,1);//查询所有主帖内容
		Comm.queryHerFollow(uid);//他还关注了
		this.joinNum(uid)//参加活动的数量
		Cn_Index.queryImpress(uid);//好友评价
	}
	,queryImpress : function(uid){
		if(!Jes.userSess())return;
		var isMy = false;
		if(uid==userInfo.userid){isMy=true};
		Jes.query('userimpress_query_sql@idx',{paraObj:"{userid:'"+ uid +"'}",isLoad:false},function(data){
			var html ='';
			for(var i=0;i<data.length;i++){
				html += '<table class="ping3"><td align="left" ><a href="../act/person.html?id='
					+ data[i].pluserid + '"><img width="50" height="50" src= "'+ Jes.getPicPath(data[i].pic) +'"/></a></td><td>'+data[i].content
					+ '  ' + data[i].createtime.substr(0,16)+'</td>';
				if(isMy){
					html +=  '<td><a href="javascript:Cn_Index.delImpress(this,\''+data[i].id+'\');">X</a></td>';
				}
				html += '</table>';
			}
			if(data.length>0){
				Jes.html('pingjia',html);
				Jes.show('divpingjia');
			}
		});
	}
	,delImpress : function(obj,id){
		Jes.executeSql({ids:id,sql:'userimpress_delete_hql'},function(){
			Cn_Index.queryImpress(userInfo.userid);
		});	
	}
	//添加个人评论
	,addImpress : function(){
		if(!Jes.userSess(1)) return;
		var userid = Jes.request('uid');
		var content = Jes('impresstext').value;
		Jes.save('CnUserimpress',{param:{content:content,flag:1,createtime:Jes.getNow(),ouserid:userid,pluserid:userInfo.userid}},function(data){
			Cn_Index.queryImpress(userid);
		});
	}
	//右边信息的初始化 
	,rightInit : function(){
		if(!Jes.userSess(1)) return;
		this.queryUserInfo();//个人信息
		Comm.rightRecommUser();//推荐用户关注
		Comm.indAct();
		Comm.recentAct();
	}
	//右边信息+说说活动 的初始化 
	,userActInit : function(){
		if(!Jes.userSess(1)) return;//session
		this.queryUserInfo();//个人信息
		Comm.newestUser();//推荐用户关注
		Comm.recentAct();//最新的活动
		var SDmodel = new scrollDoor();
		SDmodel.sd(["tab01","tab02"],["tdivs01","tdivs02"],"tabseled","tabnoseled");
	}
	//我的簇鸟 初始化
	,mycnInit : function(){
		if(!Jes.userSess(1)) return;//session
		this.queryUserInfo();//个人信息
	//	Comm.newestUser();//推荐用户关注
	//	Comm.recentAct();//最新的活动
		Cn_Index.queryImpress(userInfo.userid);
		this.queryTopic('all_topic',null,1);
		Jes.Door.init('tab11',3);
	}
	//创建活动的信息初始化
	,createActInit : function(){
		Jes.initMap('map_canvas');//地图的初始化
		Jes.html('useremail',userInfo.email);
		Jes('textphone').value = userInfo.phone;
		if(Jes('textphone').value!=null&&Jes('textphone').value!=''){//已有手机号码
			Jes('textphone').disabled=true;
			Jes('btnphone').value = '修改';
			$('#btnphone').removeClass('btn02');
		}
		Jes.html('userCity',userInfo.areaname+userInfo.cityname);
		Jes('acttime').value= Jes.getDoubleDateFormatStr(0);
		Jes('acthour').value = new Date().getHours();
	}
	//发起活动初始化
	,checkHavephone : function(obj){
		if(obj.checked==false)return;
		var phone = userInfo.phone;
		if(phone==null||phone==''){
			Cn_Index.showDiv('#hidephone','fuserid','+userid+')
		}
	}
	//判断用户来源显示信息
	,synInfo : function(){
		var cfrom = userInfo.cfrom;
		if(cfrom!=null&&cfrom.indexOf('SINA')!=-1){
			Jes('synsina').checked ='checked';
		}
		if(cfrom!=null&&cfrom.indexOf('QQ')!=-1){
			Jes('synqq').checked ='checked';
		}
	}
	//关注之后
	,aftergz : function(){
		Comm.rightRecommUser(null,null,'Cn_Index.aftergz();');
	}
	//同步数据前 判断是否已经绑定
	,synIsable : function(obj){
		if(obj.checked){
			var type = '';
			if(obj.name=='synsina'||obj.name=='synactsina'){type='SINA';}
			if(obj.name=='synqq'||obj.name=='synactqq'){type='QQ';}
			Jes.query('synisable_query_sql@idx',{paraObj:"{type:'"+ type +"'}",isLoad:false},function(data){
				if(data[0]==null||data[0].flag=='0'){
					obj.checked=false;
					Jes.alert('请先绑定'+type+'账号(请到这里操作"账号设置->第三方绑定")');
				}
			});
		}
	}
	//保存号码按钮
	,chPhone : function(obj){
		if(obj.value=='修改'){
			Jes('textphone').disabled=false;
			obj.value='保存';
			$('#btnphone').addClass('btn02');
		}else{
			if(Jes('textphone').value.length!=11){
				Jes.alert('手机位数不对');
				return;
			}else{
				Jes.executeSql({ids:'1',phone:Jes('textphone').value,userid:userInfo.userid,sql:'savephone_update_hql'},function(){
					Jes('textphone').disabled=true;
					$('#btnphone').removeClass('btn02');
					Jes('btnphone').value = '修改';
					Jes.alert('保存成功');
				});
			}
		}
	}
	//职业选择
	,fjob : function(job){
		Jes.alert(job);
		Jes('fjob').value = Jes('fjob').value + ',' + job;
		Jes('seletedoption').append()
	}
	//说说限制
	,limitSS : function(obj){
		var num = 200 - obj.value.length;
		if(num<0){
			Jes.html('ssNum','已经超出'+num.toString().substr(1,num.length)+'个字');
			Jes('isay').disabled=true;
		}else{
			//Jes.html('ssNum','还能输入'+num+'个字');
			Jes.html('ssNum','');
			Jes('isay').disabled=false;
		}
		Cn_Index.atRelation(obj);
	}
	//提到联想功能
	,atRelation : function(obj){
		var pos = Jes.getPosition($('#content')),flag=false,j=0;
		var str = obj.value.substr(0,pos);
		while(true){
			if(str.indexOf('@')!=-1){
				str = str.substr(str.indexOf('@')+1);
				j++;
				flag = true;
			}else{
				break;
			}
		}
		if(flag){
			var name = str.replace(/\s+/g,"");//不存在空格
			if(str==name){
				Jes.query('atrelation_query_sql@idx',{paraObj:"{name:'"+ name +"'}",isLoad:false},function(data){
					if(data.length==0){Jes.hide('atshow'); return;}
					var html = '';
					for(var i=0;i<data.length;i++){
						html += '<p><a href="javascript:Cn_Index.selectName(\''+data[i].loginid+'\',\''+name+'\');">'
						+ data[i].loginid + '</a><a href="../front/person.html?uid='+data[i].id+'" style="text-align:right;">看看TA的主页</a></p>';
					}
					var $height=$("#test").height();
					var ll=$height/20;
					Jes.html('atshow',html);
					var pos = Cn_Index.getElementPos('content');
					$('#atshow').css({
						top:pos.y+25,
						left:pos.x+(str.indexOf('@')+1)*12
					}).show();
				})
			}else{
				Jes.hide('atshow');
			}
		}else{
			Jes.hide('atshow');
		}
	}
	,selectName : function(loginid,name){
		Jes('content').value = Jes('content').value.replace('@'+name,'@'+loginid+' ');
		Jes.hide('atshow');
		var txt = Jes('content').createTextRange();//光标定位
		txt.moveStart('character',Jes('content').value.indexOf('@'+loginid+' ')+('@'+loginid+' ').length);
		txt.collapse(true);
		txt.select();
	}
	// @位置显示
	,atShowDiv : function (wid,hei,obj){
		alert(hei);
		var ow = $(obj).width(),oh = $(obj).height();
		var w = Jes('content').offsetLeft+wid, h = Jes('content').offsetTop+hei;
		$(obj).css({
			top:h,
			left:w
		}).show();
	}
	,getElementPos : function (elementId) {  
		 var ua = navigator.userAgent.toLowerCase();  
		 var isOpera = (ua.indexOf('opera') != -1);  
		 var isIE = (ua.indexOf('msie') != -1 && !isOpera); // not opera spoof  
		 var el = document.getElementById(elementId);  
		 if(el.parentNode === null || el.style.display == 'none') {  
		  return false;  
		 }        
		 var parent = null;  
		 var pos = [];       
		 var box;       
		 if(el.getBoundingClientRect)    //IE  
		 {           
		  box = el.getBoundingClientRect();  
		  var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);  
		  var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);  
		  return {x:box.left + scrollLeft, y:box.top + scrollTop};  
		 }else if(document.getBoxObjectFor)    // gecko      
		 {  
		  box = document.getBoxObjectFor(el);   
		  var borderLeft = (el.style.borderLeftWidth)?parseInt(el.style.borderLeftWidth):0;   
		  var borderTop = (el.style.borderTopWidth)?parseInt(el.style.borderTopWidth):0;   
		  pos = [box.x - borderLeft, box.y - borderTop];  
		 } else    // safari & opera      
		 {  
		  pos = [el.offsetLeft, el.offsetTop];    
		  parent = el.offsetParent;       
		  if (parent != el) {   
		   while (parent) {    
		    pos[0] += parent.offsetLeft;   
		    pos[1] += parent.offsetTop;   
		    parent = parent.offsetParent;  
		   }    
		  }     
		  if (ua.indexOf('opera') != -1 || ( ua.indexOf('safari') != -1 && el.style.position == 'absolute' )) {   
		   pos[0] -= document.body.offsetLeft;  
		   pos[1] -= document.body.offsetTop;           
		  }      
		 }                
		 if (el.parentNode) {   
		    parent = el.parentNode;  
		   } else {  
		    parent = null;  
		   }  
		 while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML') { // account for any scrolled ancestors  
		  pos[0] -= parent.scrollLeft;  
		  pos[1] -= parent.scrollTop;  
		  if (parent.parentNode) {  
		   parent = parent.parentNode;  
		  } else {  
		   parent = null;  
		  }  
		 }  
		 return {x:pos[0], y:pos[1]};  
	}  
  
	//设置备注名字
	,saveName : function(){
		var fuserid = Jes('fuserid').value;
		if(Jes('beizhu').value==null||Jes('beizhu').value==''){Jes.alert('先填写备注名称'); return;}
		Jes.save('cn.remark',{param:{'fuserid':fuserid,'remark':Jes('beizhu').value}},function(data){
			Jes.alert('设置成功');
			Jes('beizhu').value='';
			$('#showDiv5').hide();
		});
	}
	//我说
	,doTopic : function(){
		if(Jes('content').value==Jes('content').title){
			Jes('content').focus();return;
		}
		Jes.save('CnTopic',{param:{content:Jes('content').value,pic:Jes('topicpic').value,'synsina':Jes('synsina').checked?'1':'0','synqq':Jes('synqq').checked?'1':'0'}},function(data){
			Cn_Index.queryTopic('all_topic');
			Jes('content').value='';
			Jes.html('upImg','');
		});
	}
	//显示用户分组
	,queryUserGroup : function(type,ismy){
		Jes.query('cngroup_query_sql@idx',{paraObj:"{userid:'"+userInfo.uid+"'}",isLoad:false},function(data){
			var html=[],len=data.length;
			html.push('<li id="tab11" class="tabseled"><a href="javascript:Cn_Index.queryTopic(\'all_topic\');">所有好友</a></li>');
			for(var i=0;i<len;i++){
            	html.push('<li id="tab1'+(i+2)+'" class="tabnoseled"><a href="javascript:Cn_Index.queryTopic(\'all_topic\','+type+','+ismy+',\''+data[i].id+'\')">'+data[i].name+'</a></li>');
				Group_Id = data[i].id;
			}
			Jes.html('tabbar2',html);
			Jes.Door.init('tab1',len+1);
		});
	}
	//显示用户信息
	,queryUserInfo : function(uid){
		var _da ;
		if(uid){//查看他人的主页
			Jes.query('userinfo_query_sql@idx',{paraObj:"{userid:'"+uid+"'}",isLoad:true,isSess:0},function(da){
				_da=da[0];
				Cn_Index.__userINFO(_da);
			});
			Jes.query('cnucenter_query_sql@idx',{paraObj:"{userid:'"+uid+"'}",isLoad:true,isSess:0},function(data){
				data = data[0];
				Jes.setFormValue("form1",data);
			});
			//互相关注情况
			Jes('fuserid').value = uid;
			Cn_Index.getGz(uid);
			Comm.queryCenter(uid);
			Comm.getPersonTag('tag',uid);
		}else{
			Comm.queryCenter();
			_da = userInfo;
			Cn_Index.__userINFO(_da);
		//	Comm.queryhint();
		}
	}
	//互相关注情况
	,getGz : function(uid){
		if(!Jes.userSess())return;
		Jes.query('isgz_query_sql@idx',{paraObj:"{userid:'"+uid+"'}",isLoad:false},function(data){
				if(data==null||data==''||data[0].isgz!='1'){
					Jes.html('isgz','<a href="javascript:Cn_Index.personDoGz(\''+uid+'\');" class="add" >加关注</a>');
				}else{
					var tsgzinfo = '';
					if(data[0].name=='特别关注'){
						tsgzinfo = '<a href="javascript:Comm.doTsgz(\'tsgz\',\''+uid+'\');" title="取消特别关注" id="tsgz" class="tsgz" ></a>';
					}else{
						tsgzinfo = '<a href="javascript:Comm.doTsgz(\'tsgz\',\''+uid+'\');" title="添加到特别关注" id="tsgz"  class="notsgz"></a>';
					}
					Jes.html('isgz','<a href="javascript:Comm.qxgzshow(\'#hidegz1\',\''+uid+'\');" class="cel">取消关注</a>  '+tsgzinfo);
				}
		});
	}
	//个人主页—加关注
	,personDoGz : function(uid) {
		if(uid==userInfo.userid){
			Jes.alert("关注他人总比关注自己更好");
			return;
		}
		Jes.doSaveTObject('cn.guanzhu',{param:{'fuserid':uid}},function(data){
            Cn_Index.getGz(uid);
		});
	}
	//个人主页—取消关注
	,personCancelGz : function(){
		Jes.doSaveTObject('cn.removeguanzhu',{param:{'fuserid':Jes('fuserid').value}},function(data){
			Jes.hide('hidegz1');
			Cn_Index.getGz(Jes('fuserid').value);
		});
	}
	,__userINFO : function(_da){
		if(_da.type=='1'){
			Jes.html('loginid',_da.loginid);
		}else{//商家特殊处理
			Jes.hide('tabbar');
			Jes.show('busshow');
			Jes.html('loginid',_da.loginid);
			//认证商家
			if(_da.type=='2'){
				$('#loginid').addClass('vip').title='认证商家';
			}else{
				Jes('loginid').title='商家';
			}
			Jes('loginid').style.cssText='color:blue';
			Jes('loginid').parentNode.style.cssText='border-bottom:2px solid blue;';
		}
		var single='';
		if(_da.single==1){
			if(_da.sex==1){
				single='<span class="icopic boy" title="单身男"></span>';
			}else{
				single='<span class="icopic girl" title="单身女"></span>';
			}
		}else{
			single='<span class="icopic" title="不再单身"></span>';
		}
		Jes.html('_city', single+'<span>&nbsp;'+_da.cityname+'</span>');
		if(_da.sign!=null)
		Jes.html('sign','简介:'+_da.sign);
		if(_da.type=='0')var buspic = 'style="border:2px solid #155FBE;" ';
		Jes.html('_userpic','<a href="../front/mycn.html" ><img '+ buspic +' src="'+Jes.getPicPath(_da.pic)+'"/></a>');
		Jes.html('_personpic','<a href="javascript:void(0);" ><img src="'+Jes.getPicPath(_da.pic)+'" width="180" height="185"/></a>');
	}
	//index发送私信
	,send : function(){
		if(!Jes.isOnline()){Jes.hide('showDiv2'); return;}
		var fuserid = Jes('fuserid').value;
		var content = Jes('letter_area').value;
		if(fuserid==null||fuserid==''){Jes.alert("发送对象不对");return;}
		Jes.save('CnMsg',{param:{'fuserid':fuserid,'content':content}},function(data){
			if(data==1){
				Jes.alert('发送成功');
				Jes.hide('showDiv2');
				Cn_Sixin.init();
			}else{
				Jes.alert('发送失败')
			}
		})
	}
	,doRemoveGuanzhu : function(){
		Jes.doSaveTObject('cn.removeguanzhu',{param:{'fuserid':Jes('fuserid').value}},function(data){
			Jes.hide('hidegz1');
			Jes.alert(data);
		});
	}
	//清除已读
	,clearnum : function(num,url){
		Jes.executeSql({ids:'1',type:num,userid:userInfo.userid,sql:'clearnum_update_hql'},function(){
			
		});
		if(num!='10'){
			window.location.href=url;
		}else{
			window.open(url);
		}
	}
	//添加话题
	,addTitle : function(){
		if(Jes('content').value=='#新发现好去处#'){
			Jes('content').value='##';
		}else{
			Jes('content').value=Jes('content').value+'##';
		}
		var txt = Jes('content').createTextRange();//光标定位
		txt.moveStart('character',Jes('content').value.length-1);
		txt.collapse(true);
		txt.select();
	}
	/*
	//清除所有
	,clearall : function(){
		Jes.executeSql({ids:'1',userid:userInfo.userid,sql:'clearall_update_hql'},function(){
			null;
		});
	}*/
	,queryFriend : function(type){
		Jes.page('cnfriend_query_sql@idx',{paraObj:"{type:"+type+"}",isLoad:false},function(data){
			Jes.html('tNum','(全部'+data.totalNum+'人)');
			data = data.pageList;
			var html=[];
			for(var i=0;i<data.length;i++){
				html.push('<li><a href="#" target= "_blank"><img title="'+data[i].loginid+'" src= "'+Jes.getPicPath(data[i].pic)+'"/></a></li>');
			}
			Jes.html("myfollow",html);
		});
	}
	//个人首页—查询参与过的活动
	,personQueryAct : function(uid,page,pageSize){
		if(!Jes.isOnline())return;
		page = page || 1,pageSize = pageSize|| 15;
		Jes.page('cyhd_query_sql@act',{paraObj:'{userid:\''+uid+'\'}',page:page,pageSize:pageSize},function(data){
			var html =[], da=data.pageList;
			Jes.each(da,function(i){
				html.push(Comm._actHtml(da[i],i));
			});
			Jes.html('all_topic',html);
			var html = Jes.Page.html(data,'1');
			Jes.html('all_page',html);
			$('#tab11').removeClass('tabseled').addClass('tabnoseled');
			$('#tab12').removeClass('tabnoseled').addClass('tabseled');
		});
	}
	//个人首页—最近参与活动 活动数量 1016
	,joinNum : function(uid){
		Jes.query('lastact_query_sql@idx',{paraObj:"{userid:'"+uid+"'}",isLoad:false,isSess:0},function(data){
			var html=[];
			if(data.length>0){
				for(var i=0;i<data.length;i++){
                	html.push('<table width="100%" border="0" cellspacing="2" cellpadding="0" class="hd_zzfqtb2">');
                	html.push('<tr><td width="40" rowspan="2"><a href="../act/actview.html?id='+data[i].id+'"><img class="pic" src= "'+ CONFIG_DATA.path + data[i].actpic +'"/></a></td>');
                	html.push('<td>时间:'+data[i].acttime+'</td><td width="50" align="right"></td></tr><tr>');
                	html.push('<td colspan="2"><a href="../act/actview.html?id='+data[i].id+'">'+data[i].content+'</a>');
                	html.push('</td></tr></table>');
                	if(i==2)break;
				}
				Jes.html('lastact',html);
				Jes.show('divlastact');
			}else{
				Jes.hide('divlastact');
				Jes.show('divrecentact');
				Comm.recentAct();
			}
			var num = data.length!=0?data.length:0;
			Jes.html('tabcyhd','参与的活动(<span style="color:red">'+ num +'</span>)</a>');
		});
	}
	//显示我说
	,_TOPICDATA : null
	/*
	公用模块 其他页面也有调用
	el 返回div id
	type 1说说  2活动
	ismy 0 发起人为用户
	page 
	pageSize 
	*/
	,queryTopic : function(el,type,ismy,groupid,page,pageSize){
		ismy = ismy || 0,groupid = groupid || '',page = page || 1,pageSize = pageSize|| 15;
		if(Jes('tab12')!=null&&Jes('tab12').className=='tabseled'){
			groupid = Group_Id;
		}
		var id='';
		if(!Jes.userSess()&&uid!=null){
			id=uid
		}else{
			id = userInfo.uid;
		}
		Jes.page('cntopic_query_sql@idx',{paraObj:'{userid:\''+	id +'\',topictype:'+type+',ismy:'+ismy+',groupid:\''+groupid+'\'}',isLoad:true,'isSess':0,page:page,pageSize:pageSize},function(data){
			var html=[],_isW,actpro,da=data.pageList;
			Cn_Index._TOPICDATA = da;
			for(var i=0;i<da.length;i++){
				actpro='1';
				_isW = da[i].type==2?true:false;
				if(_isW) html.push(Comm._actHtml(da[i],i,type));
				else html.push(Comm._sayHtml(da[i],i,type));
			}
			//没有关注人  提示赶紧去关注人吧
			Jes.html(el,html);
			var html = Jes.Page.html(data,'1');
			Jes.Page.fn['1'] = function(p){
				Cn_Index.queryTopic(el,type,ismy,groupid,p,pageSize);
			}
			Jes.html('all_page',html);
		});
	}
	//单独查询活动
	//公用模块
	,queryAct : function(el,sql,page,pageSize){
		page = page || 1,pageSize = pageSize|| 15;
		Jes.page(sql,{page:page,pageSize:pageSize},function(data){
			var html =[], da=data.pageList;
			Jes.each(da,function(i){
				html.push(Comm._actHtml(da[i],i,2));
			});
			Jes.html(el,html);
			var html = Jes.Page.html(data,'1');
			Jes.Page.fn['1'] = function(p){
				Cn_Index.queryAct(el,sql,page,pageSize);
			}
			Jes.html('all_page',html);
		});
	}
	//判断私人聚会 当前是否是被邀请的用户
	,isYqr : function(actid){
		Jes.doQueryList('isyqr_query_sql@idx',{paraObj:'{actid:\''+actid+'\'}',isLoad:false},function(data){
			if(data[0].num=='0'){
				return true;
			}else{
				return false;
			}
		});
	}
	//右侧个人信息 加关注
	,rightdogz : function(obj,uid,loginid){
		if(uid==userInfo.userid){
			Jes.alert("关注他人总比关注自己更好");
			return;
		}
		Jes.doSaveTObject('cn.guanzhu',{param:{'fuserid':uid}},function(data){
            obj.parentNode.parentNode.removeChild(obj.parentNode);
            Cn_Index.initGroup(uid, loginid);
            Comm.newestUser('imaygzuser');
		});
	}
	/*他还关注了谁
	//uid 用户id  
	,queryHerFollow : function(uid){
		if(!Jes.userSess())return;
		if(Jes('herfollow_npage')!=null)var page = Jes('herfollow_npage').value || 0;
		if(Jes('herfollow_tpage')!=null&&Jes('herfollow_tpage')!=''){
			if(Jes('herfollow_tpage').value!=null){
				if(page>=Jes('herfollow_tpage').value){
					page = 0;
				}
			}
			Jes('herfollow_npage').value= page;
			var pageSize = pageSize|| 10;
			Jes.page('herfollow_query_sql@idx',{paraObj:'{userid:\''+uid+'\'}',page:page*pageSize,pageSize:pageSize,isLoad:false,isSess:0},function(data){
				Jes('herfollow_tpage').value = data.totalPages;
				var data = data.pageList;
				var html=[];
				for(var i=0;i<data.length;i++){
					html.push('<li class="mbtr"><div class="add_pic" onmouseover="Comm.namecardshow(\''+ data[i].id+'\',\'gz_'+i+'\');" onmouseout="Comm.namecardhide(\'gz_'+i+'\');">');
					html.push('<a href="./person.html?uid='+data[i].id+'"><img src="'+Jes.getPicPath(data[i].pic)+'" /></a>');
					html.push('<div id="gz_'+i+'"></div></div></li>');
				}
				Jes.html('herfollow',html);
				if(data.length>0)Jes.show('divherfollow');
				if(data.length>10)Jes.show('divherfollowmore');
			});
		}
	}
	*/
	/*评论内容显示
	*	isCreater ture=该记录是用户自己发起
	*/
	,plInit : function(num,isCreater,type){
		var id =Cn_Index._TOPICDATA[num].topicid;
		Jes.hide('zfdiv_'+id);
		var div = Jes('pldiv_'+id);
		if(!div){
			div = Jes.createEl('div',{id:'pldiv_'+id},{display:'none'});
			Jes.append(div,Jes(id));
		}
		if(div.style.display=='none'){
			Jes.doQueryList('cncomment_query_sql@idx',{isLoad:false,paraObj:'{topicid:\''+id+'\'}'},function(data){
				var html=[];
				Jes.show('pldiv_'+id);
				html.push('<div class="reply02" id="hidepl">');
                	html.push('<div class="topbg"></div>');
                		html.push('<div class="replycon" >');
                          html.push('<div class="replyconnt"> <a class="faceicon1" title="表情" style="display:none"></a>');
                            html.push('<textarea onkeyup="Cn_Index.limitPl(this)" id="pl_'+id+'" name="pl_'+id+'" style="overflow:hidden; height:22px;width:410px"></textarea>');
                            html.push('<a class="btn_normal" id="btnpl" href="javascript:void(0);" onclick="Cn_Index.pl(\''+id+'\');"><em>评论</em></a>');
                            html.push('<div class="margin_b">');
                              html.push('<input type="checkbox" id="plzf_'+id+'"/>');
                              html.push('<label class="MIB_txtbl">同时转发到我的微博</label>');
                            html.push('</div>');
                            html.push('<div class="replylist" id="pl_list_'+id+'">');
                              html.push('<ul id="pl_list_'+id+'">');
                              for(var i=0;i<data.length;i++){
                              	if(isCreater||(data[i].userid==userInfo.userid)){//发帖本人 和发评论本人
                              		html.push('<li onmouseover="showhidediv(\'hideclose'+data[i].id+'\')" onmouseout="showhidediv(\'hideclose'+data[i].id+'\')" style="z-index:'+(999-i).toString()+';">');          	
	                		  	}else{
	                		  		html.push('<li style="z-index:'+(999-i).toString()+';">');
	                		  	}
                                  html.push('<div class="commentsTxt"><div class="compic" onmouseover="Comm.namecardshow(\''+data[i].userid+'\',\'namec'+data[i].id+'\')" onmouseout="Comm.namecardhide(\'namec'+data[i].id+'\')">  <a href="./person.html?uid='+data[i].userid+'" title="'+data[i].loginid+' class="comimg"><img width="40" height="40" class="picborder_l" title="'
                                  	  +data[i].loginid+'" src="'+Jes.getPicPath(data[i].pic)+'"/></a><div id="namec'+data[i].id+'"></div></div>');
                                  	html.push('<div id="hideclose'+data[i].id+'" class="icon_closel" style="display:none;" onclick="Cn_Index.delPl(this,\''+data[i].id+'\',\''+id+'\');" title="删除"> x </div>');
                                    html.push('<div class="commentsContants">');
                                      html.push('<p class="commentsParm"><a href="javascript:void(0);" class="textname">'+data[i].loginid+'</a> :'+data[i].content+'('+data[i].ctime.substr(0,19)+')</p>');
                                      html.push('<div class="commentOption">');
                                      	//回复他人
                                        if(data[i].userid!=userInfo.userid)html.push('<p class="rt"><a class="ico_reply" href="javascript:void(0);" onclick="Cn_Index.reply(\''+id+'\',\''+data[i].loginid+'\',\''+data[i].userid+'\');">回复</a></p>');
                                      html.push('</div>');
                                      html.push('<div class="clearit"></div>');
                                    html.push('</div>');
                                  html.push('</div>');
                                html.push('</li>');
                                }
                              html.push('</ul>');
                            html.push('</div>');
                          html.push('</div>');
                        html.push('</div>');
                        html.push('<div class="botbg"></div>');
                      html.push('</div>');
				Jes.html(div,html);
			});
		setTimeout('Cn_Index.focusPl(pl_'+id+')',500);
		}else Jes.hide('pldiv_'+id);
	}
	,focusPl : function(id){
		Jes(id).focus();
	}
	//评论的字数限制
	,limitPl : function(obj,topicid){
		var num = 50 - obj.value.length;
		if(num<0){
			Jes('btnpl').disabled=true;
		}else{
			Jes('btnpl').disabled=false;
		}
	}
	//私信的字数限制
	,limitSx : function(obj,topicid){
		var num = 180 - obj.value.length;
		if(num<0){
			Jes.html('sx_leftnum','说明：已超过'+num.toString().substr(1,num.length)+'字');
			Jes('btn_sxsend').disabled=true;
		}else{
			Jes.html('sx_leftnum','说明：还可以输入'+num.toString()+'字');
			Jes('btn_sxsend').disabled=false;
		}
	}
	//评论回复初始化
	,reply : function(topicid,loginid,replyid){
		Jes('pl_'+topicid).value = '回复@'+loginid+':';
		//Jes('pl_'+topicid).focus();//怎么焦点放不到textarea里
		var txt = Jes('pl_'+topicid).createTextRange();//光标定位
		txt.moveStart('character',Jes('pl_'+topicid).value.length);
		txt.collapse(true);
		txt.select();
		Jes('replyid').value=replyid;
	}
	//评论回复按钮
	,pl: function(id){
		var pl = Jes('pl_'+id),plVal=pl.value,plzf = Jes('plzf_'+id),rid=Jes('replyid').value;
		if(plVal==''){
			Jes.alert('评论内容不能为空!');
			pl.focus();
			return;
		}
		Jes.doSaveTObject('CnComment',{param:{'topicid':id,content:plVal,reuserid:rid,iszf:plzf.checked?'1':'0'}},function(data){
			//Jes.alert('评论成功');
			pl.value='';
			plzf.checked=false;
			Jes.html('plnum_'+id,parseInt(Jes('plnum_'+id).innerHTML)+1);
			var li =Jes.createEl('li');
			var html=[];
            html.push('<div class="commentsTxt"><div class="compic"> <a href="./person.html?uid='+userInfo.userid+'" title="'+userInfo.loginid+' class="comimg"><img width="40" height="40" class="picborder_l" title="'
            +userInfo.loginid+'" src="'+Jes.getPicPath(userInfo.pic)+'"/></a></div>');
            html.push('<div id="hideclose" class="icon_closel" style="display:none;" title="删除"></div>');
            html.push('<div class="commentsContants">');
            html.push('<p class="commentsParm"><a href="javascript:void(0);" class="textname">'+userInfo.loginid+'</a> :'+plVal+'('+Jes.getCurrentDate(1)+')</p>');
            html.push('<div class="commentOption">');
            html.push('</div>');
            html.push('<div class="clearit"></div>');
            html.push('</div>');
            html.push('</div>');
			/*
			html.push('<div class="commentsTxt"><a href="javascript:void(0);" title="'+userInfo.loginid+'" class="comimg"><img width="40" height="40" class="picborder_l" title="'+userInfo.loginid+'" src="'+Jes.getPicPath(userInfo.pic)+'"/></a>');
			html.push('<div class="commentsContants"><p class="commentsParm"><a href="javascript:void(0);" class="textname">'+userInfo.loginid+'</a> :'+plVal+'('+Jes.getCurrentDate(1)+')</p>');
		    html.push('<div class="commentOption"><p class="rt"><a class="ico_reply" onclick="Cn_Index.delPl(this,\''+data.id+'\',\''+id+'\');">删除</a></p></div>');
		    html.push('<div class="clearit"></div></div></div>');*/
			Jes.html(li,html);
			Jes.append(li,'pl_list_'+id);//应该插入到第一行
		//	Jes.insertAfter(li,'pl_list_'+id);
		});
	}
	,delPl : function(obj,plid,topicid){
		if(!confirm("你确定删除评论吗？")) return;
		Jes.executeSql({ids:plid,topicid:topicid,sql:'cncomment_delete_hql'},function(){
			Jes.alert('删除成功');
			var el = obj.parentNode.parentNode;
			el.parentNode.removeChild(el);
			Jes.html('plnum_'+topicid,parseInt(Jes('plnum_'+topicid).innerHTML)-1);
		});
	}
	//转发的字数限制
	,limitZf : function(obj,topicid){
		var num = 120 - obj.value.length;
		if(num<0){
			Jes.html('leftnum',num.toString());
			Jes('btn_'+topicid).disabled=true;
		}else{
			Jes.html('leftnum',num.toString());
			Jes('btn_'+topicid).disabled=false;
		}
	}
	//转发初始化	type:用来区分tab页
	,zfInit : function(num,type){//id-->topicid
		var da = Cn_Index._TOPICDATA[num],topicid = da.topicid;
		var _zf ='';
		if(da.zfid){
			_zf = '//@' +da.loginid +' : ' + da.content;//使用class
		}
		Jes.hide('pldiv_'+topicid);
		var div = Jes('zfdiv_'+topicid);
		if(!div){
			div = Jes.createEl('div',{id:'zfdiv_'+topicid},{display:'none'});
			Jes.append(div,Jes(topicid));
			var html = '<div class="reply03"><div class="topbg"></div>'
			+ '<div class="replycon"><h3><span>转发'+(da.type=='1'?'说说':'活动')+'</span></h3><div class="replyconnt">'
			+ '<textarea id="con_' + topicid + '" style="overflow:hidden; height:60px; width:96%" onkeyup="Cn_Index.limitZf(this,\''+topicid+'\')">'+_zf+'</textarea>'
			+ '<div class="margin_b">'
	        + '<div class="repbot rt"><img style="display:none" src="../themes/default/images/ico_smile.gif" width="31" height="20" class="repface" />&nbsp;&nbsp;&nbsp;&nbsp;<span>还可以输入：'
	        + '<font style="font-family:\'隶书\'" id="leftnum">120</font>字</span><input type="button" id="btn_' + topicid + '" onclick="Cn_Index.doZf('+num+');" class="send" name="转　发" value="转　发" /></div>'
	        + '</div></div></div><div class="botbg"></div></div>';
	        Jes.html('zfdiv_'+topicid,html);
		}
		if(div.style.display=='none'){
			Jes.show('zfdiv_'+topicid);
			Jes('con_'+topicid).focus();
		}else{
			Jes.hide('zfdiv_'+topicid);
		}
	}
	//转发
	,doZf : function(num){
		var da = Cn_Index._TOPICDATA[num];
		var zfid = da.zfid || da.topicid,content =Jes('con_'+da.topicid).value;
		if(content == ''){
			Jes.alert('转发内容不能为空!');
			//Jes('con_'+da.topicid).focus();
			var txt = Jes('con_'+da.topicid).createTextRange();//光标定位
			txt.moveStart('character',Jes('con_'+da.topicid).value.length);
			txt.collapse(true);
			txt.select();
			return;
		}
		Jes.save('CnTopic',{param:{'zfid':zfid,'content':content,posttime:Jes.getCurrentDate("0"),plnum:0,zfnum:0}},function(data){
			Cn_Index.queryUserInfo();
			Cn_Index.queryTopic('all_topic');
			//Jes.alert('转发成功');
			Jes.hide('zfdiv_'+da.topicid);
			//Jes.close('s');
		});
	}
	,doFav : function(num){
		var topicid = Cn_Index._TOPICDATA[num].topicid,fel = Jes('fav'+num);
		fel.href='javascript:void(0)';
		Jes.html(fel,'已收藏');//Jes.getCurrentDate("0")
		Jes.save('CnFavor',{param:{'topicid':topicid}},function(data){
			//Jes.alert('收藏成功!');
		});
	}
	,delTopic :function(num){
		var da = Cn_Index._TOPICDATA[num],id=da.topicid,objid=da.objid,type=da.type;
		if(!confirm("你确定删除主贴吗？")) return;
		var param = {ids:id,sql:'cntopic_delete_hql'};
		if(type==2) param = {ids:id,actid:objid,sql:'cnacttopic_delete_hql'};
		Jes.executeSql(param,function(){
			Cn_Index.queryUserInfo();
			Cn_Index.queryTopic('all_topic');
		});
	}
	//通用加关注 1020
	,doGuanzhu : function(fuserid, fuserloginid) {
		if(fuserid==userInfo.userid){
			Jes.alert("关注他人总比关注自己更好");
			return;
		}
		Jes.doSaveTObject('cn.guanzhu',{param:{'fuserid':fuserid}},function(data){
			var url = window.location.href;
            if(url.indexOf('actview.html')!=-1){
            	 this.location.reload();
            }else{
	            Cn_Index.queryUserInfo();
	            Cn_Index.queryTopic('all_topic');
	            Comm.newestUser();//最新注册
	            Comm.queryHerFollow(fuserid);//个人主页的  推荐用户
	            //Cn_Index.initGroup(fuserid, fuserloginid);
            }
		});
	}
    // 初始化分组页面
    ,initGroup : function(fuserid, fuserloginid) {
        Jes('fuserid').value = fuserid;
        Jes.html('fuserlongid',fuserloginid);
        Jes.doQueryList('cngroup_query_sql@idx',{paraObj:"{userid:'"+ userInfo.userid +"'}",isLoad:false},function(data){
        	var html = [];
        //	html.push('<li><a href="#"><input type="checkbox" class="group_01" />同学</a></li><li><a href="#"><input type="checkbox" class="group_01" />'+
        //		'同事</a></li><li><a href="#"><input type="checkbox" class="group_01" />亲戚</a></li>');
            for (var i = 0; i < data.length; i++) {
                html.push('<li><a href="javascript:void(0);"><input type="checkbox" value="' + data[i].id + '">' + data[i].name + '</a></li>')
            }
            Jes.html('option_groups',html);
        });
        Cn_Index.showDiv('#showDiv4');
    }
	,showDiv : function (obj,divname,divvalue){
		if(divname!=null&&divname!=''){//传值
			Jes(divname).value = divvalue;
		}
		var pz = ___getPageSize(), ps = ___getPageScroll();
		var ow = $(obj).width(),oh = $(obj).height();
		$(obj).css({
			top:(pz[3]-oh)/2 + ps[1],
			left:(pz[2]-ow)/2 +ps[0]
		}).show();
	}
    ,addNewGroup: function() {
        Jes.doSaveTObject('cn.addnewgroup', {param: {groupName: $('#newGroupName').val().trim()}}, function(groupId) {
            if (groupId == "0") {
                Jes.alert("分组已存在");
            } else {
                $('#option_groups').append('<li><a href="javascript:void(0);"><input type="checkbox" value="' + groupId + '">' + $('#newGroupName').val() + '</a></li>');
            }
            $('#newGroupName').val('');
            Cn_Index.queryUserInfo();
            Cn_Index.queryTopic('all_topic');
            Comm.newestUser();
        });
    }
    ,doGroup : function() {
        var groupIds = $('#showDiv4 :checked').val();
        if(groupIds==null||groupIds==''){
        	groupIds = '1';//默认为 未分组
        }
        Jes.doSaveTObject('cn.savefriendgroup', {param: {fuserid: $('#fuserid').val(), groupIds: groupIds}}, function(data) {
            $('#showDiv4').hide();
        });
    }
    //用户默认海报
	,defaulthb : function(id){
		var pic = '',picable=false,conable=false;
		var jpic = Jes('actpic').value;
		var jcon = Jes('act.content').value;
		if(jpic==''||jpic=='chifan.jpg'||jpic=='chifan.jpg'||jpic=='chifan.jpg'||jpic=='chifan.jpg'||jpic=='chifan.jpg'||jpic=='chifan.jpg')picable=true;
		if(jcon==''||jcon=='大家一起来聚餐吧!'||jcon=='大家一起去喝杯吧！'||jcon=='很久没唱歌了,一起KTV吧！'||jcon=='最近有新电影哦，一起去看吧！'
		||jcon=='一起去逛街血拼下吧！'||jcon=='我们要买醉，去PUB吧！')conable=true;
		switch (id){
			case "1":
				if(picable)pic = 'chifan.jpg';
				if(conable){
				Jes('act.content').value='大家一起来聚餐吧!';
				Jes('act.content').title='大家一起来聚餐吧!';
				}
				break;
			case "2":			
			if(picable)pic = 'kafei.jpg';
			if(conable){
			Jes('act.content').value='大家一起去喝杯吧！';
			Jes('act.content').title='大家一起去喝杯吧！';
				}
			break;
			case "3":
						if(picable)	pic = 'ktv.jpg';
			if(conable){
			Jes('act.content').value='很久没唱歌了,一起KTV吧！';
			Jes('act.content').title='很久没唱歌了,一起KTV吧！';
				}
			break;	
			case "4":
						if(picable)	pic = 'dianying.jpg';
			if(conable){
			Jes('act.content').value='最近有新电影哦，一起去看吧！';
			Jes('act.content').title='最近有新电影哦，一起去看吧！';
				}
			break;	
			case "5":
						if(picable)	pic = 'gouwu.jpg';
			if(conable){
			Jes('act.content').value='一起去逛街血拼下吧！';
			Jes('act.content').title='一起去逛街血拼下吧！';
				}
			break;	
			case "6":
						if(picable)	pic = 'jiuba.jpg';
			if(conable){
			Jes('act.content').value='我们要买醉，去PUB吧！';
			Jes('act.content').title='我们要买醉，去PUB吧！';
				}
			break;	
			case "7":
			break;	
			case "8":
			break;	
			case "9":
			break;	
		}
		/*
		if(id==1){
			pic = 'chifan.jpg';
			Jes('act.content').value='大家一起来聚餐吧!';
			Jes('act.content').title='大家一起来聚餐吧!';
		}
		if(id==2){
			pic = 'kafei.jpg';
			Jes('act.content').value='大家一起去喝杯吧！';
			Jes('act.content').title='大家一起去喝杯吧！';
		}
		if(id==3){
			pic = 'ktv.jpg';
			Jes('act.content').value='很久没唱歌了,一起KTV吧！';
			Jes('act.content').title='很久没唱歌了,一起KTV吧！';
		}
		if(id==4){
			pic = 'dianying.jpg';
			Jes('act.content').value='最近有新电影哦，一起去看吧！';
			Jes('act.content').title='最近有新电影哦，一起去看吧！';
		}
		if(id==5){
			pic = 'gouwu.jpg';
			Jes('act.content').value='一起去逛街血拼下吧！';
			Jes('act.content').title='一起去逛街血拼下吧！';
		}
		if(id==6){
			pic = 'jiuba.jpg';
			Jes('act.content').value='我们要买醉，去PUB吧！';
			Jes('act.content').title='我们要买醉，去PUB吧！';
		}
		if(id==7){
			pic = 'lvyou.jpg';
			Jes('act.content').value='好久没旅行了，大家一起去吧！';
			Jes('act.content').title='好久没旅行了，大家一起去吧！';
		}
		if(id==8){
			pic = 'yundong.jpg';
			Jes('act.content').value='兄弟们,一起去运动流汗下吧！';
			Jes('act.content').title='兄弟们,一起去运动流汗下吧！';
		}
		if(id==9){
			pic = 'yangchu.jpg';
			Jes('act.content').value='最近有不错的演出哦，一起去看啊！';
			Jes('act.content').title='最近有不错的演出哦，一起去看啊！';
		}
		if(id==10){
			pic = 'zhuoyou.jpg';
			Jes('act.content').value='三国杀或狼人，晚上桌游！';
			Jes('act.content').title='三国杀或狼人，晚上桌游！';
		}
		if(id==11){
			pic = 'qita.jpg';
			Jes('act.content').value='晚上干嘛去？簇鸟告诉你！';
			Jes('act.content').title='晚上干嘛去？簇鸟告诉你！';
		}
		*/
		Jes('actpic').value = pic;
	}
	//主题的内容
	,contentOnfocus : function(obj){
		if(obj.value=='大家一起来聚餐吧!'||
		obj.value=='大家一起去喝杯吧！'||
		obj.value=='很久没唱歌了,一起KTV吧！'||
		obj.value=='最近有新电影哦，一起去看吧！'||
		obj.value=='我们要买醉，去PUB吧！'||
		obj.value=='好久没旅行了，大家一起去吧！'||
		obj.value=='兄弟们,一起去运动流汗下吧！'||
		obj.value=='最近有不错的演出哦，一起去看啊！'||
		obj.value=='三国杀或狼人，晚上桌游！'||
		obj.value=='晚上干嘛去？簇鸟告诉你！'){
			obj.value=''; 
			obj.style.color='#000000';
		} 
	}
	/* search页面部分 */
	//index 跳转到 search页面
	,searchTo : function(content,type){
		if(typeof(content)=='undefined'){
			content=Jes('searcht').value;
		}
		if(typeof(type)=='undefined'){
			type=1;
		}
		if(content!=null&&content!=''){
			window.location.href='/cuniao/cuniao/front/search.html?content='+encodeURI(content)+'&type='+type;
		}else{
			window.location.href='/cuniao/cuniao/front/search.html';
		}
	}
	//search页面初始化
	,searchInit : function (){
		if(!Jes.userSess(1))return;
		var content,type;
		if(Jes.request('content')!=null){
			var content = decodeURI(Jes.request('content'));
		}else{
			content='';
		}
		type = Jes.request('type');
		if(type==null||type=='')type=1;
		if(content)Cn_Index.search(content,type);
		this.queryUserInfo();//个人信息
	}
	,changeSearch : function(tabnum){
		Jes('searchtype').value = tabnum;
		for(var i=1;i<3;i++){
			if(i!=tabnum){
				$('#comtitle0'+i).removeClass('current');
				Jes.hide('comcon0'+i);
			}
		}
		$('#comtitle0'+tabnum).addClass('current');
		Jes.show('comcon0'+tabnum);
		Cn_Index.dosearch();
	}
	,dosearch : function(){
		var content = Jes('content').value,type;
		if(Jes('comtitle01').className=='current'){
			type='1';
		}else{
			type='2';
		}
		Cn_Index.searchTo(content,type);
	}
	//查找
	,search : function(content,type){
		if(content==null||content==''||content.length==0)return;
		Jes('content').value = content;
		Jes.html('scontent','搜索: ' + content);
		var page = page || 1,pageSize = pageSize|| 15;
		var html=[];
		if(type){
			Jes.show('comcon0'+type);
			$('#comtitle0'+type).addClass('current');
		}else{
			Jes.show('comcon01');
			$('#comtitle01').addClass('current');
			type=1;
		}
		if(type=='1'){
			Jes.page('search_query_sql@idx',{paraObj:"{content:'"+content+"',type:'"+type+"'}",isLoad:false,page:page,pageSize:pageSize,isSess:0},function(data){
				var data = data.pageList,aHtml='';
				for(var i=0;i<data.length;i++){
					aHtml +=Comm._actHtml(data[i],i);
				}
				aHtml = Cn_Index.strWeight(aHtml,content);
				Jes.html('comcon01',aHtml);
			});	
		}else{
			Jes.page('search_query_sql@idx',{paraObj:"{content:'"+content+"',type:'"+type+"'}",isLoad:false,page:page,pageSize:pageSize,isSess:0},function(data){
				var data = data.pageList,userUrl;
				html.push('<ul class="MIB_feed" id="msg_list" popcontainer="true">');
				for(var i=0;i<data.length;i++){
					html.push('	<li class="MIB_linedot_l downline" onmouseover="showhid(\'downmenu'+i+'\');" onmouseout="showhid2(\'downmenu'+i+'\');">');
					html.push(' <div class="user_pic user_Stat"> <div class="head_pic" >');
					
					if(data[i].usertype==2||data[i].usertype==0){
						userUrl='../front/indexbus.html?uid='+data[i].id;
					}else{
						userUrl='../front/person.html?uid='+data[i].id;
					}
					html.push('<a href="'+userUrl+'" class="add_pic" title="'+ data[i].loginid +'"><img style="width:50px;height:50px;"  src="'+ Jes.getPicPath(data[i].pic) +'" title="'+ data[i].loginid +'" class="picborder_l"/></a>');					
					html.push('</div></div><div class="MIB_feed_c"><div id="downmenu'+i+'" class="gz_prompt" style="display:none;" >');	
	     		   	if(data[i].isgz==1){//已关注
	     		   		if(data[i].ishxgz==1){//互相关注
	     		   			html.push('<p><a href="javascript:void(0);"  style="color:#ED1B24">已互相关注</a></p>');
	     		   		}else{
	     		   			html.push('<p><a href="javascript:void(0);" onclick="Cn_Friend.qgzshow(\'#hidegz2\',\''+data[i].fuserid+'\')" style="color:#ED1B24">求关注</a></p>');
	     		   		}
	     		   	}else{//未关注
	     		   	    html.push('<p><a href="javascript:void(0);" onclick="Cn_Friend.qgzshow(\'#hidegz2\',\''+data[i].fuserid+'\')" style="color:#ED1B24">求关注</a></p>');
	       				html.push('<p><a href="javascript:void(0);" onclick="Cn_Index.doGuanzhu(\''+data[i].fuserid+'\',\''+data[i].loginid+'\')" style="color:#ED1B24">加关注</a></p>');
	     		   	}
					html.push('</div><p><a href="javascript:void(0);">'+ Cn_Index.strWeight(data[i].loginid,content) +'</a></p><div class="gz_con" id="moreinfo'+i+'">');
	      		    html.push('<p class="gz_js" >关注 '+data[i].follownum+' | 被关注'+data[i].fansnum+' | 活动'+data[i].reqnum+'</p><p class="gz_js" >简介： '+Cn_Index.strWeight(data[i].sign,content)+ ' </p>');
	    		    html.push('</div></div><div class="clear"></div></li>');
				}
				html.push('</ul>');
				Jes.html('comcon02',html);
			});	
		}
	}
	,strWeight : function(orgString,indString){
		var rsl = orgString.replace(indString,'<span style="font-weight: bold;font-size:14px;color:red">'+indString+'</span>');
		return rsl;
	}
    //隐藏展示
    ,showhidediv : function(id){
                var sbtitle = document.getElementById(id);
                if (sbtitle) {
                    if (sbtitle.style.display == 'block') {
                        sbtitle.style.display = 'none';
                    } else {
                        sbtitle.style.display = 'block';
                    }
                }
	}
	//邀请未注册展开收起效果
	,showYqinfo : function(el){
		if($('#'+el).hasClass('down')){
			$('#'+el).removeClass('down');
			$('#'+el).addClass('up')
			document.getElementById(el).innerHTML='&nbsp;&nbsp;收&nbsp;&nbsp;起&nbsp;&nbsp;&nbsp;&nbsp;';
		}else{
			$('#'+el).removeClass('up');
			$('#'+el).addClass('down');
			document.getElementById(el).innerHTML='站外好友';
		}
	}
	//展开收起效果
	,showMoreMap : function(el){
		if($('#'+el).hasClass('down')){
			$('#'+el).removeClass('down');
			$('#'+el).addClass('up')
			document.getElementById(el).innerHTML='隐藏地图';
		}else{
			$('#'+el).removeClass('up');
			$('#'+el).addClass('down');
			document.getElementById(el).innerHTML='查看地图';
		}
	}
	//发送好友邮件
	,sendMails : function(name){
		var mails = Jes(name).value;
		if(mails==null||mails=='')return;
		Jes.doSaveTObject('cn.sendmails', {param: {mails: mails}}, function(data) {
			if(data==true){
				Jes.alert('发送成功');
				Jes(name).value = '';
			}
        });
	}
	//发送好友短信
	,sendPhones : function(name){
		var phones = Jes(name).value;
		if(phones==null||phones=='')return;
		var content = '"你的好友("'+ userInfo.getUsername()+ '")在簇鸟网(www.cuniao.com)发起了活动,并邀请您参加.簇鸟网'
			+'是专注于朋友之间的聚会活动平台，希望你能分享聚会的乐趣和认识新朋友。该信息来自簇鸟网(www.cuniao.com)";'
		
	}
	//上传活动照片 0110
	,uploadActpic : function(){
		var pic = Jes('plfilename').value;
		if(pic==null)return;
		Jes.save('CnActpic',{param: {pic: pic,actid:Jes.request('id'),content:Jes('picremark').value}},function(data){
			Jes.hide('upform');
			Cn_ActView.actpicshow(Jes.request('id'));
			Jes.html('upImg','');
		});
	}
}

Cn_Act = {
	init : function(){
		if(!Jes.userSess(1)) return;//session
		//Jes.Select.buss();
		//$('starttime').value = Jes.getCurrentDate();
		var t = Jes.request('t') || '2';
		Cn_Act.query(t);
	}
	//首页发现活动初始化
	,findActInit : function(){
		if(!Jes.userSess(1)) return;
		//时间初始化
		html = '<a href="javascript:Cn_Act.addCondition(this,\'fztime\',\'时间\',\'今天\',\''+Jes.getDateFormatStr(0)+'\');" class="time">今天:'+Jes.getWeekStr(0)+'('+Jes.getDateStr(0)+')</a><a href="javascript:Cn_Act.addCondition(this,\'fztime\',\'时间\',\'明天\',\''+Jes.getDateFormatStr(1)+'\');" class="time">明天:'+Jes.getWeekStr(1)+'('+Jes.getDateStr(1)+')</a><a href="javascript:Cn_Act.addCondition(this,\'fztime\',\'时间\',\'后天\',\''+Jes.getDateFormatStr(2)+'\');" class="time">后天:'+Jes.getWeekStr(2)+'('+Jes.getDateStr(2)+')</a>'
			+'<br/><a href="javascript:Cn_Act.addCondition(this,\'fztime\',\'时间\',\''+Jes.getDateStr(3)+'\',\''+Jes.getDateFormatStr(3)+'\');" class="time">'+Jes.getWeekStr(3)+'('+Jes.getDateStr(3)+')</a><a href="javascript:Cn_Act.addCondition(this,\'fztime\',\'时间\',\''+Jes.getDateStr(4)+'\',\''+Jes.getDateFormatStr(4)+'\');" class="time">'+Jes.getWeekStr(4)+'('+Jes.getDateStr(4)+')</a><a href="javascript:Cn_Act.addCondition(this,\'fztime\',\'时间\',\''+Jes.getDateStr(5)+'\',\''+Jes.getDateFormatStr(5)+'\');" class="time">'
			+ Jes.getWeekStr(5) + '(' + Jes.getDateStr(5) + ')</a><a href="javascript:Cn_Act.addCondition(this,\'fztime\',\'时间\',\''+Jes.getDateStr(6)+'\',\''+Jes.getDateFormatStr(6)+'\');" class="time">'+Jes.getWeekStr(6)+'('+Jes.getDateStr(6)+')</a>';
		Jes.html('ddztime',html);
		//职业初始化
		if(userInfo!=null){
			Jes.query('cnjob_query_sql@idx',{paraObj:"{userid:'"+userInfo.uid+"'}",isLoad:false},function(data){
				var html =[];
				html.push('发起人职业：');
				for(var i=0;i<data.length;i++){
	               html.push('<a href="javascript:Cn_Index.fjob(\''+data[i].job+'\');">'+data[i].job+'</a>');
				}
				html.push('<input type="button" id="fjobmore" name="fjobmore" onclick="" value="选择多种职业">')
				Jes.html('tdfjob',html);
			});
		}
		var param = "{city:'"+ Jes('cityid').value +"'}";
		Comm.findAct('all_topic',param);//正文活动
		Comm.rightRecommUser();//推荐用户关注
		Comm.indAct();
		Comm.recentAct();
	}
	,query : function(t){
		if(t.substr(0,1)=='1'){//所有活动  初始化
			var html = '<li id="tab111" class="tabseled"><a href="javascript:Cn_Act.query(\'1_1\');">好友发起</a></li>'
					+'<li id="tab112" class="tabnoseled"><a href="javascript:Cn_Act.query(\'1_2\');">陌生人发起</a></li>'
					+'<li id="tab113" class="tabnoseled"><a href="javascript:Cn_Act.query(\'1_3\');">我自己发起</a></li>';
			Jes.html('tabbar12',html);
			if(t.length==1)t='1_1';
		}
		if(t.substr(0,1)=='2'){//正在参加的活动  初始化
			var html = '<li id="tab111" class="tabseled"><a href="javascript:Cn_Act.query(\'2_1\');">已参加</a></li>'
				+'<li id="tab112" class="tabnoseled"><a href="javascript:Cn_Act.query(\'2_2\');">被邀请</a></li>'
				+'<li id="tab113" class="tabnoseled"><a href="javascript:Cn_Act.query(\'2_3\');">申请加入</a></li>';
			Jes.html('tabbar12',html);
			if(t.length==1)t='2_1';
		}
		if(t.substr(0,1)=='3'){//已经结束的活动  初始化
			var html = '<li id="tab111" class="tabseled"><a href="javascript:Cn_Act.query(\'3_1\');">所有结束活动</a></li>';
			Jes.html('tabbar12',html);
			if(t.length==1)t='3_1';
		}
		var _t = t.split('_'),lev1=_t[0],lev2=_t[1];
		for(var i=1;i<=3;i++){//第一层 效果
			if(i!=lev1) {
				$('#tab1'+i).removeClass('tabseled');
			}
		}
		$('#tab1'+lev1).addClass('tabseled');
		for(var i=1;i<4;i++){
			if(i!=lev2) {
				$('#tab11'+i).removeClass('tabseled');
			}
		}
		$('#tab11'+lev2).addClass('tabseled');
		if(t=='1_1'){
			//Cn_Index.queryTopic('my_topic',2,0);//所有活动-好友活动
			Cn_Index.queryAct('my_topic','noticreater_query_sql@act');//所有活动-好友发起的活动
			Cn_Index.__nameCardId='';
		}
		if(t=='1_2'){
			Cn_Index.queryAct('my_topic','strangeract_query_sql@act');//所有活动-陌生人发起的活动
			Cn_Index.__nameCardId='';
		}
		if(t=='1_3'){
			Cn_Index.queryAct('my_topic','createract_query_sql@act');//所有活动-我发起的活动
			Cn_Index.__nameCardId='';
		}
		if(t=='2_1'){
			Cn_Index.queryAct('my_topic','myinact_query_sql@act');//参与的活动—已参加
			Cn_Index.__nameCardId='';
		}
		if(t=='2_2'){
			Cn_Index.queryAct('my_topic','mayiact_query_sql@act');//参与的活动—被邀请
			Cn_Index.__nameCardId='';
		}
		if(t=='2_3'){
			Cn_Index.queryAct('my_topic','waitact_query_sql@act');//参与的活动—等待审核
			Cn_Index.__nameCardId='';
			//Cn_Act.queryAct('my_topic','timeoff_query_sql@act');//参与的活动—被邀请
		}
		if(t=='3_1'){
			Cn_Index.queryAct('my_topic','timeoff_query_sql@act');//结束过期活动
			Cn_Index.__nameCardId='';
		}
	}
	//发起活动
	,doAct : function(){formact
		var param = DWRExtUtil.getFormValue("formact",1);
		if(param==null)return;
		param = DWRExtUtil.getFormValue("form2",1);
		param.acttype = Jes('acttype').value;
		if(Jes('act.content').value==null||Jes('act.content').value==''){
			Jes.alert("活动主题不允许为空");
			return;
		}else{
			param.content = Jes('act.content').value;
		}
		param.acttime = Jes('acttime').value;
		param.acthour = Jes('acthour').value;
		param.endtime = Jes('endtime').value;
		param.endhour = Jes('endhour').value;
		param.address = userInfo.areaname+userInfo.cityname+Jes('address').value;
		param.actpic = Jes('actpic').value;
		param.cityid = userInfo.city;
		if(Jes('userids').value!=null&Jes('userids').value!=''){
			var i =0;
			if(Jes('noticeemail').checked){
				i += parseInt(Jes('noticeemail').value);
			}
			if(Jes('noticephone').checked){
				i += parseInt(Jes('noticephone').value);
			}
			param.noticetype = i;
		}else{
			param.noticetype = 0;
		}
		var j =0;//提醒类型
		if(Jes('hintemail').checked){
			j += parseInt(Jes('hintemail').value);
		}
		if(Jes('hintmsg').checked){
			j += parseInt(Jes('hintmsg').value);
		}
		param.hinttype = j;
		var issh = param.issh.split('_');
		Jes.each(issh,function(i){
			if(this!='null') param.issh = this;
		});
		var feetype = param.feetype.split('_');
		Jes.each(feetype,function(i){
			if(this!='null') param.feetype = this;
		});
		var actpro = param.actpro.split('_');
		Jes.each(actpro,function(i){
			if(this!='null') param.actpro = this;
		});
		param.accyq='1';//默认   1 参加的好友可以邀请其他人  2不授权
		param.synactsina = Jes('synactsina').checked?'1':'0';
		param.synactqq = Jes('synactqq').checked?'1':'0';
		if(param==null) return;
		Jes.save('CnAct',{param:param},function(data){
			Cn_Index.queryTopic('all_topic');
			if(data!=null){
				Jes('actid').value = data;
				Jes.alert('成功发起活动');
			}else{
				Jes.alert('出错了');
			}
			Jes('act.content').value='';
			Jes.Upload.del();
		});
	}
	//寻找活动部分___添加条件 916
	//对象 对象名称 标题 内容 后台值
	,addCondition : function(obj,name,title,value,realvalue,endvalue){
		if(name=='fztime'){//时间特殊处理
			Jes('actstarttime').value = realvalue;
			Jes('actendtime').value = endvalue!=null?endvalue:realvalue;
		}else{
			var hidename = name.substr(1,name.length);
			Jes(hidename).value= realvalue;
		}
		Jes.show('seletedoption');
		$('#selected').append('<dd id="dd'+name+'"><a href="javascript:Cn_Act.removeCondition(this,\'dd'+name+'\')" ><h5>' + title + '：</h5>'
			+ value + '<span class="ico_close"></span></a></dd>');
		var el = [];
		Cn_Index.showhidediv('tr'+name);
		this.findAct();
	}
	//寻找活动部分__删除条件
	,removeCondition : function(obj,name){
	 	Jes(name).parentNode.removeChild(Jes(name));
		Cn_Index.showhidediv('tr'+name.substr(2,name.length));
		if(name=='ddfztime'){//特殊处理
			Jes('actstarttime').value='';
			Jes('actendtime').value='';
		}else{
			Jes(name.substr(3,name.length)).value='';
		}
		var html = Jes('selected').innerHTML;
		if(html.indexOf('ico_close')=='-1'){
			Jes.hide('seletedoption');
		}
		this.findAct();
	}
	//发现活动
	,findAct : function(){
		var param = "{city:'"+ Jes('cityid').value +"',acttype:'"+ Jes('ztype').value +"',starttime:'"+ 
			Jes('actstarttime').value +"',endtime:'"+ Jes('actendtime').value +"'}";
		Comm.findAct('all_topic',param);
	}
	//改变div成check
	,changediv : function(obj){
		$('#lizy').addClass('disnone');
		$('#lizy_check').removeClass('disnone');
	}
	//恢复div
	,canceldiv : function(){
		$('#lizy').removeClass('disnone');
		$('#lizy_check').addClass('disnone');
	}
	//展开收起效果
	,changedownup : function(el){
		if($('#'+el).hasClass('down')){
			$('#'+el).removeClass('down');
			$('#'+el).addClass('up')
			document.getElementById(el).innerHTML='收起';
		}else{
			$('#'+el).removeClass('up');
			$('#'+el).addClass('down');
			document.getElementById(el).innerHTML='高级';
		}
	}
	//打钩选值状态
	,getValue : function(obj,value,title){
		if($('#lizy'+value).hasClass('current')){
			$('#lizy'+value).removeClass('current');
			Jes('tempztype').value = Jes('tempztype').value.replace(',' + value,'');//删值
			Jes('tempztype').title = Jes('tempztype').title.replace(';' + title,'');
		}else{
			$('#lizy'+value).addClass('current');
			Jes('tempztype').value = Jes('tempztype').value + ',' + value;//取值
			Jes('tempztype').title = Jes('tempztype').title + ';' + title;
		}
	}
	//显示是否审核
	,showIssh : function(obj){
		if(obj.value=='1'){//公开
			Jes.show('publicSh');
		}else{
		//	Jes('issh').disabled=true;
		//	Jes('issh').disabled=true;
			Jes.hide('publicSh');
		}
	}
	,doJoinAct : function(actid,isag,userid){
		var info = '你确定加入此活动吗？';
		if(isag==1) info='你确定同意吗？';
		else if(isag ==2) info='你确定不同意吗？';
		if(!confirm(info)) return;
		Jes.doSaveTObject('cn.joinact',{param:{'actid':actid,'isag':isag,'userid':userid}},function(data){
			Cn_Index.queryMore(actid);
			Jes.alert(data+',你将被授于邀请其他好友的权利');
		});
	}
	//活动html
	,acthtml : function (da){
		var status ='';
		if(da.stauts=='0'){//被邀请的 可以直接参加
			status='直接参加'
		}
		if(da.status=='1'){//申请加入
			status = '等待确认';
		}
		if(da.status=='2'){//已参加
			status='已成功参加';
		}
		
		var html = '<table width="101%" border="0" cellspacing="0" cellpadding="0" class="pingl"><tr>'
		+'<td width="75" rowspan="3" align="left" class="pinglimg" onmouseover="Comm.namecardshow(\''+da.userid+'\',\'top_'+da.actid +'\');" onmouseout="Comm.namecardhide(\'top_'+da.topicid+'\');"><p><img src= "' 
		+ Jes.getPicPath(da.pic)+'" alt="'+da.username+'" title="'+da.username+'"/></p>'
		+ '<div class="head_pic" id="top_'+da.actid +'"></div><p><a href="javascript:void(0);" class="red14"></a></p></td>'
		+'<td width="111" rowspan="3" align="left" class="hdimg"><img onclick="window.location.href=\'../act/actview.html?id='+da.actid+'\'" src= "'+ CONFIG_DATA.path+act.actpic+'"/></td>'
		+'<td><span class="gray2">'+da.acttime+' 时 </span></td>'
		+'<td width="89">'+status+'</td></tr>'
		+'<tr><td><a href="javascript:void(0);" class="red14"></a><a href="javascript:void(0);" class="red14">主题：</a><a href="javascript:void(0);" class="gray1">'+da.content+'</a></td>'
		+'<td>参加人数：<span class="bigred2">'+act.factnum+'/'+act.maxnum+'</span></td></tr><tr><td class="cjhd"><ul>';
		var us = da.actusers.split(',');
		Jes.each(us,function(j){
			html +='<li><img src= "'+Jes.getPicPath(us[j])+'"/></li>'
		});
		html+='</ul></td><td >&nbsp;</td></tr><tr><td></td><td colspan="2">'+da.createtime.substr(0,19)+'</td>'
		//+'<td align="right">	<a href="javascript:void(0);" onclick="Cn_Index.zfInit(this,'+i+');" class="gray2">转发(<span id="zfnum_'+da.topicid+'">'+da.zfnum+'</span>)</a>| <a href="javascript:Cn_Index.doFav('+i+');" id="fav'+i+'" class="gray2">收藏</a> | <a href="javascript:Cn_Index.plInit(\''+da.topicid+'\');" class="gray2">评论(<span id="plnum_'+da.topicid+'">'+da.plnum+'</span>)</a></td>'
		//+'</tr><tr><td colspan="4"><div id="'+da.objid+'"></div><div id="'+da.topicid+'"></div></td>
		+'</tr></table>';
		return html;
	}
	,joinMyAct : function(status){
		//if(status ==0) Jes.clearHint(2); //邀请的活动
		Jes.doQueryList('cnjoinact_query_sql@idx',{paraObj:'{status:'+status+'}'},function(data){
			var html=[],_isW;
			for(var i=0;i<data.length;i++){
				_isW = data[i].type==2?true:false;
				html.push('<li class="mbtl"><img src="'+Jes.getPicPath(data[i].pic)+'" alt="'+data[i].username+'" title="'+data[i].username+'" width="50" height="50"/></a></li>');
				html.push('<li class="mbtr"><a href="http://www.douban.com/people/chisu0921/">'+data[i].username+'</a>');
				if(_isW) html.push('【活动】');
				html.push('<span class="pl">&nbsp;'+data[i].posttime+'&nbsp;说：</span>');
				html.push('<span class="pl">'+data[i].content+'<span>');
				if(_isW) html.push('<a href="javascript:" onclick="Cn_Index.queryMore(\''+data[i].objid+'\');">详情</a>');
				if(userInfo.userid==data[i].tuserid) html.push(' <a href="javascript:Cn_Index.delTopic(\''+data[i].topicid+'\',\''+data[i].objid+'\','+data[i].type+');">删除</a>');
				html.push('</span></li><div class="clear"></div><div id="'+data[i].objid+'"></div>');
			}
			Jes.html("topic",html);
		});
	}
	,addBus : function(obj){
		Jes.open({type:'s',width:'500',title:'选择商家',url:'buslist.html'});
	}
	//申请活动页面__邀请好友
	,inviteUser : function(obj){
		Jes.open({type:'s',width:'600',heigth:'300',title:'选择好友',button:'<a href="javascript:window.frames[\'jes_s_url\'].Cn_User.add();" class="btn06">确定</a><a href="javascript:Jes.close(\'s\');" class="btn05">关闭</a>',url:'userlist.html'});
		Jes('jes_s_url').style.height='300px';
		//Jes.open({type:'s',width:'500',title:'选择邀请人',url:'userlist.html'});
	}
	//wayne
	,delUser : function(el){
		var puserids = Jes('userids').value;
		puserids=puserids.replace(el.id+'_','');
		puserids=puserids.replace('_'+el.id,'');
		puserids=puserids.replace(el.id,'');
		el.parentNode.removeChild(el);
		Jes('userids').value= puserids;
	}
	//活动详情页面__邀请好友
	,actinviteUser : function(obj){
		Jes.open({type:'s',width:'600',heigth:'300',title:'选择好友',
		button:'<a href="javascript:window.frames[\'jes_s_url\'].Cn_User.add();" class="btn06">确定</a><a href="javascript:Jes.close(\'s\');" class="btn05">关闭</a>',
		url:'../front/userlist.html?busid='+Jes.request('id')+''});
		Jes('jes_s_url').style.height='300px';
	}
	//用户收藏活动页面
	,showfav : function(){
		Jes.query('favview_query_sql@act',{isLoad:false},function(data){
			var html='';
			Cn_Index._TOPICDATA = data;
			for(var i=0;i<data.length;i++){
				var da = data[i];
				html += Cn_Act._showfavHtml(da,i);
            }
           	Jes.html('numcounts',data.length);
			Jes.html('feed_list',html);
			})
	}
	,_showfavHtml : function(da,i){
		var html = '';
			var act = eval("("+da.extra+")");
			var lnum=act.maxnum-act.factnum;
			var feetype=CONFIG_DATA.FEETYPE[act.feetype];
			var time=Jes.formatDate(new Date(act.acttime),'2').replace('111','2011').substr(5);
			html +='<table width="101%" border="0" cellspacing="0" cellpadding="0" class="pingl">'
				  +'<tr>'
                    +'<td width="75" rowspan="3" align="left" valign="top" onmouseover="Comm.namecardshow(\''+da.tuserid+'\',\'top_'+da.topicid+'\');" onmouseout="Comm.namecardhide(\'top_'+da.topicid+'\');" ><a href="#" class="pinglimg" ><img src= "'+Jes.getPicPath(da.pic)+'"/></a>'
                      +'<div class="head_pic" id="top_'+da.topicid+'"></div><p><a href="../act/actview.html?id='+da.objid+'" class="red14"></a></p></td>'
                    +'<td width="111" rowspan="3" align="left" class="hdimg"><a href="../act/actview.html?id='+da.objid+'"><img src= "'+ CONFIG_DATA.path+act.actpic+'"/></a></td>'
                    +'<td ><span class="gray2">'+time+' '+act.acthour+'时  '+feetype+'</span></td>'
                    +'<td width="89"><input name="input22" type="button" class="btn_hdbm" value="" onclick="window.location.href=\'../act/actview.html?id='+da.objid+'\'"/></td>'
                  +'</tr>'
                  +'<tr>'
                    +'<td><a href="javascript:void(0);" class="red14"></a><a href="javascript:void(0);" class="red14">'+da.loginid+'：</a><a href="../act/actview.html?id='+da.objid+'" class="gray1">'+da.content+'</a></td>'
                    +'<td >人数：<span class="bigred2">'+act.factnum+'/'+act.maxnum+'</span></td>'
                  +'</tr>'
                  +'<tr>'
                    +'<td class="cjhd"><ul>';
	            	if(da.actusers!=null&&da.actusers!=''){
							var us = da.actusers.split(',');
							Jes.each(us,function(j){
								var _u = us[j].substring(1,us[j].indexOf(':')),_p = us[j].substring(us[j].indexOf(':')+1,us[j].length-1);
								html +='<li onmouseover="Comm.namecardshow(\''+_u+'\',\'join_'+ da.topicid + _u + j +'\');" onmouseout="Comm.namecardhide(\'join_'
									+ da.topicid + _u + j +'\');"><img src= "'+Jes.getPicPath(_p)+'"/><div id="join_'+ da.topicid + _u + j + '"></div></li>';
							});
	            	}else{
	            		html += '<li><a href="../act/actview.html?id='+da.objid+'" title="欢迎加入"><img src="/cuniao/cuniao/themes/default/images/han.jpg"/></a></li>';
	            	}
                        html+='</ul></td>'
                    +'<td >&nbsp;</td>'
                  +'</tr>'
                  +'<tr>'
                    +'<td>&nbsp;</td>'
                    +'<td colspan="3" class="tablebot" width="530"><p style="float:left;">收藏于('+da.addtime.substr(0,19)+')</p>'
                      +'<p style="float:right;"><a href="javascript:Cn_Index.zfInit('+i+');" class="gray2">转发(<span id="zfnum_'+da.topicid+'">'+da.zfnum+'</span>)</a><span class="MIB_line_l">|</span><a href="javascript:Cn_Act.cancelFav(\''+da.favid+'\');" id="fav'+da.favid+'" class="gray2">取消收藏</a><span class="MIB_line_l">|</span><a href="javascript:Cn_Index.plInit('+i+');" class="gray2">评论(<span id="plnum_'+da.topicid+'">'+da.plnum+'</span>)</a></p></td>'
                  +'</tr>'
                  +'<tr>'
                    +'<td colspan="4"><div id="'+da.objid+'"></div><div id="'+da.topicid+'"></div></td>'
                  +'</tr>'
                +'</table>';
                
		return html;
	}
	//取消收藏
	,cancelFav : function(favid){
		if(favid==null||favid=='')return;
		if(!confirm("你确定取消收藏吗？")) return;
		Jes.executeSql({ids:favid,sql:'canfavor_delete_hql'},function(){
			var el = Jes('fav'+favid).parentNode.parentNode.parentNode.parentNode;
			el.parentNode.removeChild(el);
			Jes.html('numcounts',parseInt(Jes('numcounts').innerHTML)-1);
		});
	}
	//活动详情页面—收藏
	,saveFav : function(obj){
		if(!Jes.userSess(1))return;
		var busid = Jes.request('id');
		Jes.query('findtopic_query_sql@act',{paraObj:"{actid:'"+busid+"'}",isLoad:false},function(data){
			if(data!=null&&data!=''){
				var topicid = data[0].id;
				Jes.save('CnFavor',{param:{'topicid':topicid,addtime:Jes.getCurrentDate("0")},isLoad:false},function(data){
					Jes.alert('已收藏');
				});
			}
		});
	}
	//活动详情页面—删除活动
	,deleteAct : function(obj){
		var id = Jes.request('id');
		if(!confirm("已有人参加了,你确定删除活动吗？")) return;
		Jes.query('findtopic_query_sql@act',{paraObj:"{actid:'"+id+"'}",isLoad:false},function(data){
			if(data!=null&&data!=''){
				var topicId = data[0].id;
				Jes.executeSql({ids:id,sql:'act_delete_hql'},function(){
					Jes.alert('删除成功,将跳转到个人首页');
					window.location.href='../front/index.html';
				});
			}
		});
	}
}

//评论页面
Cn_Plun ={
	init : function(){
		if(!Jes.userSess(1)) return;//session
		this.query();
	}
	//评论的展示
	,query : function(){
		Jes.doQueryList('pluninfo_query_sql@idx',null,function(data){
			var html=[],viewId='',userUrl='';
			for(var i=0;i<data.length;i++){
				if(data[i].zfid!=null&&data[i].zfid!=''){
					viewId=data[i].zfid;
				}else{
					viewId=data[i].topicid;
				}
				if(data[i].type=='1'){
					userUrl='../front/person.html?uid='+data[i].userid;
				}else{
					userUrl='../front/indexbus.html?uid='+data[i].userid;
				}
				html.push('<li class="commentsCell downline" onmouseover="showhid(\'downmenu'+data[i].id+'\')" onmouseout="showhid2(\'downmenu'+data[i].id+'\')">');
				html.push('<div class="selector"><input type="checkbox" name="checkbox" class="ckb" onclick="Cn_Plun.selected(this)" id="'+data[i].id+'" value="'+data[i].topicid+'"></div><div class="commentsTxt" >');
				html.push('<a href="'+userUrl+'" title="'+data[i].loginid+'" class="comimg"><img class="picborder_l" style="width:55px;height:55px;" title="'+data[i].loginid+'" src="'+ Jes.getPicPath(data[i].pic) +'"/></a>');
				html.push('<div id="downmenu'+data[i].id+'" class="icon_closel" style="display:none;" onclick="Cn_Plun.delPl(this,\''+data[i].id+'\',\''+data[i].topicid+'\');" title="删除"> x </div><div class="commentsContants">');
				html.push('<p class="commentsParm"><span class="textname">'+data[i].loginid+'</span>: '+data[i].comment+'  ('+data[i].ctime.substr(0,16)+')');
				html.push('</p><div class="commentOption"><p class="from"><label class="MIB_txtbl">评论主题为：</label>"<a href="javascript:void(0);" onclick="Cn_Plun.gotoView(\''+data[i].objid+'\',\''+viewId+'\')"> '+data[i].content+' </a>"');
				html.push('</p><p class="rt"><a href="javascript:void(0);" onclick="Cn_Plun.gotoView(\''+data[i].objid+'\',\''+viewId+'\')" >全部</a><span style="margin:0 5px;">|</span>');
				html.push('<a class="ico_reply" href="javascript:void(0);" onclick="Cn_Plun.showReply(\''+data[i].id+'\',\''+data[i].loginid+'\',\''+data[i].userid+'\')" >回复</a></p></div><div class="clearit"></div></div></div><div class="clearit"></div>');
				//评论回复
				html.push('<div class="reply" id="reply_'+data[i].id+'" style="display:none"><div class="topbg"></div><div class="replycon"><div class="replyconnt">');
				html.push('<a class="faceicon1" href="javascript:void(0);" title="表情" ></a><textarea id="text_'+data[i].id+'" style="overflow:hidden; height:22px;"></textarea>');
				html.push('<a class="btn_normal" id="#" onclick="Cn_Plun.dopl(\''+data[i].topicid+'\',\''+data[i].id+'\')"><em>评论</em></a><div class="margin_b"><input type="checkbox" id="plzf_'+data[i].id+'"/>');
				html.push('<label class="MIB_txtbl">同时转发到我的微博</label></div></div></div><div class="botbg"></div></div>');
				//评论回复结束
				html.push('<div class="clearit"></div></li>');
			}
			Jes.html('count',data.length);
			Jes.html('commentsList',html);
		})
	}
	//查看全部 详细信息
	,gotoView : function(objId,topicId){
		if(objId=='null'||objId==''){//评论的主题是说说  null??
			window.location.href='./plview.html?id='+topicId;
		}else{
			window.location.href='../act/actview.html?id='+objId;
		}
	}
	,_plSayHtml : function(da,i,type){
		var html ='<table width="100%" border="0" cellspacing="0" cellpadding="0" class="pingl">'
				+'<tr>'
                    +'<td width="75" rowspan="5" align="left" valign="top" onmouseover="Comm.namecardshow(\''+ da.tuserid+'\',\'top_'+da.topicid+ type +'\');" onmouseout="Comm.namecardhide(\'top_'+ da.topicid + type +'\');" ><a href="" class="pinglimg" ><img src= "'+ Jes.getPicPath(da.pic)+'"/></a><div class="head_pic" id="top_'+ da.topicid + type +'" ></div></td>'
                    +'<td></td>'
                  +'</tr>'
                  +'<tr>'
                    +'<td><a href="javascript:void(0);" class="red14">'+da.loginid+'：</a><span href="javascript:void(0);" class="gray1">'+da.content+Comm._imgHtml(da.topicpic)+'</span></td>'
                  +'</tr>'
        //如果是转发
        if(da.zfid){
        	zfda = da.extList[0];
        	if(zfda.type=='1'){
        		html+='<tr>'
                    +'<td colspan="2"><div class="yiny">'
                        +'<div class="yinyt"></div>'
                        +'<div class="yinyc"><a href="javascript:void(0);" class="gray3">@'+zfda.loginid+':</a> <a href="javascript:void(0);" class="gray4">'+zfda.content+'</a> <a href="javascript:void(0);" class="gray2">原文转发('+zfda.zfnum+')</a> | <a href="javascript:void(0);" class="gray2">原文评论('+zfda.plnum+')</a></div>'
                        +'<div class="yinyb"></div>'
                      +'</div></td>'
                  +'</tr>';
        	}else if(zfda.type=='2'){//活动
        		var act = eval("("+zfda.extra+")"),lnum=act.maxnum-act.factnum,feetype=CONFIG_DATA.FEETYPE[act.feetype],time=(act.acttime.month+1)+'月'+act.acttime.day+'日';
	     		//转发begin
	        	html+='<tr>'
                    +'<td><div class="yiny">'
                        +'<div class="yinyt"></div>'
                        +'<div class="yinyc">'
                          +'<table width="100%" border="0" cellspacing="0" cellpadding="0" class="zf_hdq">'
                            +'<tr>'
                              +'<td width="111" rowspan="3" align="left" class="hdimg"><img src= "'+ CONFIG_DATA.path+act.actpic+'"/></td>'
                              +'<td><span class="gray2">'+time+' '+act.acthour+'时  '+feetype+'</span></td>'
                              +'<td width="89"><input name="input22" type="button" class="btn_hdbm" value="" onclick="window.location.href=\'../act/actview.html?id='+act.id+'\'"/></td>'
                            +'</tr>'
                            +'<tr>'
                              +'<td><a href="javascript:void(0);" class="red14"></a><a href="javascript:void(0);" class="red14">'+zfda.loginid+'：</a><a href="javascript:void(0);" class="gray1">'+zfda.content+'</a></td>'
                              +'<td >参加人数：<span class="bigred2">'+act.factnum+'/'+act.maxnum+'</span></td>'
                            +'</tr>'
                            +'<tr>'
                              +'<td class="cjhd"><ul>';
                    			var us = zfda.actusers.split(',');
								Jes.each(us,function(j){
									var _u = us[j].substring(1,us[j].indexOf(':')),_p = us[j].substring(us[j].indexOf(':')+1,us[j].length-1);
									html +='<li onmouseover="Comm.namecardshow(\''+_u+'\',\'join_'+ da.topicid + _u + j + type +'\');" onmouseout="Comm.namecardhide(\'join_'
										+ da.topicid + _u + j + type +'\');"><img src= "'+Jes.getPicPath(_p)+'"/><div id="join_'+ da.topicid + _u + j + type +'"></div></li>';
								});
                                html+='</ul></td>'
                              +'<td >&nbsp;</td>'
                            +'</tr>'
                            +'<tr>'
                              +'<td colspan="3" class="tablebot" width="530"><p style="float:left;">50分钟前</p>'
                                +'<p style="float:right;"> <a href="javascript:void(0);" class="gray2">原文转发('+zfda.zfnum+')</a><span class="MIB_line_l">|</span> <a href="javascript:void(0);" class="gray2">原文评论('+zfda.plnum+')</a></p></td>'
                            +'</tr>'
                            +'<tr>'
                              +'<td colspan="4"></td>'
                            +'</tr>'
                          +'</table>'
                        +'</div>'
                        +'<div class="yinyb"></div>'
                      +'</div></td>'
                  +'</tr>';
                  //转发end
        	}
        }
                  html+='<tr>'
                    +'<td colspan="3" class="tablebot" width="530"><p style="float:left;">'+da.posttime.substr(0,19)+'</p>'
                      +'<p style="float:right;"> ';
                  	if(da.tuserid==userInfo.userid){//只能删除自己的
                  		html += '<a href="javascript:Cn_Index.delTopic('+i+');" class="gray2">删除</a><span class="MIB_line_l">|</span>';
                  	}//说说取消收藏功能  <a href="javascript:Cn_Index.doFav('+i+');" id="fav'+i+'" class="gray2">收藏</a><span class="MIB_line_l">|</span>
                  html +='<a href="javascript:Cn_Index.zfInit('+i+');" class="gray2">转发(<span id="zfnum_'+da.topicid+'">'+da.zfnum+'</span>)</a><span class="MIB_line_l">|</span><a href="javascript:Jes(\'plContent\').focus();"  class="gray2">评论(<span id="plnum_'+da.topicid+'">'+da.plnum+'</span>)</a></p></td>'
                  +'</tr>'
                  +'<tr>'
                    +'<td height="8" colspan="2"><div id="'+da.objid+'"></div><div id="'+da.topicid+'"></div></td>'
                  +'</tr>'
                +'</table>';
		return html;
	}
	//评论详情页面!!
	,viewInit : function(){
		Jes('plContent').value='';
		var id = Jes.request('id');
		Jes.doQueryList('plview_query_sql@idx',{paraObj:"{id:'"+ id +"'}",isLoad:false},function(data){
			var html = Cn_Plun._plSayHtml(data[0],'0');
		//	var html = Comm._sayHtml(data[0],'0');
			Cn_Index._TOPICDATA = data;
			Jes.html('tabdiv',html);
			//初始化评论部分
			Jes.doQueryList('allplinfo_query_sql@idx',{paraObj:"{id:'"+ id +"'}",isLoad:false},function(data){
			var html=[];
			Jes.each(data,function(i){
			html.push('<li class="commentsCell" ');
				if(userInfo!=null&&(data[i].fqr==userInfo.userid||data[i].userid==userInfo.userid)){//活动发起人 才能删除
                	html.push(' onmouseover="showhid(\'colse'+data[i].id+'\')" onmouseout="showhid2(\'colse'+data[i].id+'\')"');
                }
              html.push('style="z-index:'+(999-i).toString()+';" ><div class="commentsTxt"> <div class="compic" onmouseover="Comm.namecardshow(\''+data[i].userid+'\',\'namec'+data[i].id+'\')" onmouseout="Comm.namecardhide(\'namec'+data[i].id+'\')">');
                html.push('<a href="../front/person.html?uid='+data[i].userid+'" title="'+data[i].loginid+'" class="comimg"><img width="40" height="40" class="picborder_l" title="'+data[i].loginid+'" src="'+Jes.getPicPath(data[i].pic)+'"/></a>');
               	html.push('<div id="namec'+data[i].id+'"></div></div>');
               	html.push('<div id="colse'+data[i].id+'" class="icon_closel" style="display:none;"  onclick="Cn_ActView.delActPlun(this,\''+data[i].id+'\',\''+data[i].topicid+'\')"title="删除"> x </div>');
                html.push('<div class="commentsContants">');
                  html.push('<p class="commentsParm"><a href="javascript:void(0);" class="textname">'+data[i].loginid+'</a> :'+data[i].content+'('+data[i].ctime+') </p>');
                  html.push('<div class="commentOption">');
                  if(userInfo!=null&&data[i].userid!=userInfo.userid){//不是本人就能回复
                  	  html.push('<p class="rt"><a  href="javascript:Cn_Plun.reply(\''+data[i].loginid+'\',\''+data[i].userid+'\')" class="ico_reply" >回复</a> </p>');
                  }
                  html.push('</div>');
                  html.push('<div class="clearit"></div>');
                html.push('</div>');
              html.push('</div>');
            html.push('</li>');
			});	
			Jes.html('commentscontent',html);
			});
		})
	}
	//评论回复初始化
	,reply : function(loginid,replyid){
		Jes('plContent').value = '回复@'+loginid+':';
		var txt = Jes('plContent').createTextRange();//光标定位
		txt.moveStart('character',Jes('plContent').value.length);
		txt.collapse(true);
		txt.select();
		Jes('replyid').value=replyid;
	}
	//评论详情页面--》发评论
	,doPlun: function(){
		var id = Jes.request('id'),plVal=Jes('plContent').value,plzf = Jes('plzf'),rid=Jes('replyid').value;
		if(plVal==''){
			Jes.alert('评论内容不能为空!');
			pl.focus();
			return;
		}
		Jes.doSaveTObject('CnComment',{param:{'topicid':id,content:plVal,reuserid:rid,iszf:plzf.checked?'1':'0'}},function(data){
			Jes('plContent').value='';
			plzf.checked=false;
			//Cn_Plun.viewInit();
		});
	}
	//selected
	,selected : function(obj){
		if(obj.checked){
        	Jes('commids').value =Jes('commids').value +','+ $(obj).attr('id');
        	Jes('topicids').value =Jes('topicids').value +','+ $(obj).attr('value');
    	}else{
       	 	Jes('commids').value=Jes('commids').value.replace(','+ $(obj).attr('id'),'');
       	 	Jes('topicids').value=Jes('topicids').value.replace(','+ $(obj).attr('value'),'');
    	}
	}
	//allselect
	,allSelect: function(obj){
		if(obj.checked){
        	$("input[name='checkbox']").each(
        	function(){
        	Jes('commids').value =Jes('commids').value +','+ $(this).attr('id');
        	Jes('topicids').value =Jes('topicids').value +','+ $(this).attr('value');
        	this.checked=true;
        	});
        	Jes('selectalls').checked=true;
        	Jes('selectalle').checked=true;
    	}else{
       	 	$("input[name='checkbox']").each(function(){this.checked=false;});
       	 	Jes('commids').value='';
       	 	Jes('topicids').value='';
       	 	Jes('selectalls').checked=false;
        	Jes('selectalle').checked=false;
    	}
	}
	//批量删除
	,allDel : function(){
		var plids = Jes('commids').value.split(',');
		var tids = Jes('topicids').value.split(',');
		if(plids.length==1){ Jes.alert("请先选择要删除的评论"); return;}
		if(!confirm("你确定删除评论吗？")) return;
		for(var i=0;i<plids.length;i++){
			if(plids[i]!==''&&tids[i]!==''){
				Jes.executeSql({ids:plids[i],topicid:tids[i],sql:'cncomment_delete_hql'},function(){
					null;
				});
			}
		}
		Jes('commids').value='';
       	Jes('topicids').value='';
		Jes('selectalls').checked=false;
        Jes('selectalle').checked=false;
		Jes.alert('删除成功');
		Cn_Plun.init();
	}
	//删除评论
	,delPl : function(obj,plid,topicid){
		if(!confirm("你确定删除评论吗？")) return;
		Jes.executeSql({ids:plid,topicid:topicid,sql:'cncomment_delete_hql'},function(){
			Jes.alert('删除成功');
			var el = obj.parentNode.parentNode;
			el.parentNode.removeChild(el);
			var i = Jes('count').innerHTML;
			Jes.html('count',i-1);
		});
	}
	//回复评论
	,showReply : function(id,loginid,replyid){
		var div = Jes('reply_'+id);
		if(div.style.display=='none'){
			Jes.show('reply_'+id);
			Jes('text_'+id).value = '回复@'+ loginid + ':';
		//	Jes('text_'+id).focus();
			var txt = Jes('text_'+id).createTextRange();//光标定位
			txt.moveStart('character',Jes('text_'+id).value.length);
			txt.collapse(true);
			txt.select();
		}else{
			Jes.hide('reply_'+id);
		}
		Jes('replyid').value = replyid;
	}
	//提交评论
	,dopl : function(topicid,id){
		var pl = Jes('text_'+id),plVal=pl.value,plzf = Jes('plzf_'+id),rid=Jes('replyid').value;
		if(plVal==''){
			Jes.alert('评论内容不能为空!');
			pl.focus();
			return;
		}
		Jes.doSaveTObject('CnComment',{param:{'topicid':topicid,reuserid:rid,content:plVal,iszf:plzf.checked?'1':'0'}},function(data){
			Jes.alert('评论成功');
			pl.value='';
			plzf.checked=false;
			Cn_Plun.showReply(id);
		});
	}
}
/** 
 *私信页面
 */
Cn_Sixin ={
	init : function(){
		if(!Jes.userSess(1)) return;
		this.query();
	}
	//私信详情页面_初始化
	,viewInit : function(){
		if(!Jes.userSess(1)) return;
		var ruserid = Jes.request('ruserid');
		Cn_Sixin.queryView(ruserid);
	}
	//私信展示
	,query : function(){
		Jes.doQueryList('sxquery_query_sql@idx',null,function(data){
			var html=[];
			for(var i=0;i<data.length;i++){
				if(data[i].ruserid=='1'){//系统通知
					html.push('<li class="MIB_linedot_l"><div class="user_pic user_Stat">  <div class="head_pic" >');
					html.push('<span style="color:red">簇鸟通知</span> ');
	                html.push('<div class="add_pic_div"  style="display:none;"></div></div></div>');
	                html.push('<div class="MIB_feed_c"><div class="rt icon_closel" title="删除"><a href="javascript:void(0);" style="display:none" onclick="showDiv(\'#showDiv6\')" class="close">x</a></div>');
	                if(data[i].isto==0){//接受到的
						html.push('<p class="letter"><a namecard="true"  href="javascript:void(0);" title="'+ data[i].loginid +'">'+ data[i].loginid +'</a>');
					}else{
						html.push('<p class="letter">我发送给<a namecard="true" href="javascript:void(0);" title="'+ data[i].loginid +'">'+ data[i].loginid +'</a>');
					}
	                html.push('：'+data[i].content+'</p><div class="feed_att MIB_linkbl"><div class="lf"><span class="gray9">'+data[i].createtime+'</span><em class="reportBtn">');
	                html.push('<span class="MIB_line_l"></span></em></div>');
	                html.push('<div class="rt"><a style="color:#878787;" href="./sixinview.html?ruserid='+data[i].ruserid+'">共'+data[i].num+'条系统通知</a><span class="MIB_line_l"></span>');
	                html.push('</div></div></div><div class="clear"></div></li>');
				}else{
					html.push('<li class="MIB_linedot_l"><div class="user_pic user_Stat">  <div class="head_pic" >');
					html.push('<a href="./person.html?uid='+data[i].ruserid+'" class="add_pic" title="'+ data[i].loginid +'" >  ');
	                html.push('<img style="width:50px;height:50px;" src="'+ Jes.getPicPath(data[i].pic) +'" title="'+ data[i].loginid +'" class="picborder_l"/></a> ');
	                html.push('<div class="add_pic_div" style="display:none;"></div></div></div>');
	                html.push('<div class="MIB_feed_c"><div class="rt icon_closel" title="删除"><a href="javascript:void(0);" style="display:none" onclick="showDiv(\'#showDiv6\')" class="close">x</a></div>');
	                if(data[i].isto==0){//接受到的
						html.push('<p class="letter"><a namecard="true"  href="javascript:void(0);" title="'+ data[i].loginid +'">'+ data[i].loginid +'</a>');
					}else{
						html.push('<p class="letter">我发送给<a namecard="true" href="javascript:void(0);" title="'+ data[i].loginid +'">'+ data[i].loginid +'</a>');
					}
	                html.push('：'+data[i].content+'</p><div class="feed_att MIB_linkbl"><div class="lf"><span class="gray9">'+data[i].createtime+'</span><em class="reportBtn">');
	                html.push('<span class="MIB_line_l">|</span><a href="javascript:;" onclick="showDiv(\'#showDiv7\')" style="color:#878787;">举报</a></em></div>');
	                html.push('<div class="rt"><a style="color:#878787;" href="./sixinview.html?ruserid='+data[i].ruserid+'">共'+data[i].num+'条对话</a><span class="MIB_line_l">|</span>');
	                html.push('<a style="color:#878787;"  onclick="Cn_Index.showDiv(\'#showDiv2\',\'fuserid\',\''+data[i].ruserid+'\')" >回复</a></div></div></div><div class="clear"></div></li>');
				}
			}
			Jes.html('msg_list',html);
		});
	}
	//私信详情页面初始化
	,queryView : function(ruserid){
		if(ruserid!=null&&ruserid!=''){
			Jes('userpic').src=Jes.getPicPath(userInfo.pic);
			Jes.doQueryList('sxview_query_sql@idx',{paraObj:"{ruserid:'" + ruserid +" '}",isLoad:false},function(data){
			var rslHtml='';var username="";var j=0;
			for(var i=0;i<data.length;i++){
				var flag=false;var html='';
				if(data[i].userid==userInfo.userid)flag=true;//记录是当前用户
				if(flag){html='<li class="MIB_msg_r">';}else{html='<li class="MIB_msg_l">';}
				html+='<div class="head_pic" >'
            			+'<a href="javascript:void(0);" ><img style="width:50px;height:50px;" src="'+ Jes.getPicPath(data[i].pic) +'" /></a>'
            		+'</div>'
            		+'<div class="MIB_msg_c" onmouseover="showhid(\'sx_'+data[i].id+'\')" onmouseout="showhid2(\'sx_'+data[i].id+'\')">'
            		+'<a href="javascript:void(0);" onclick="Cn_Sixin.del(\''+data[i].id+'\',this)" id="sx_'+data[i].id+'" style="display:none" class="msg_close" title="删除"></a>'
                		+'<div class="rd_tr"></div>'
                		+'<div class="rd_tl"></div>'
                		+'<p class="msg_detail gray6">';
        		if(flag)html +='发送给';
        			html +='<a href="javascript:void(0);" id="username'+i+'">某某</a>：'+data[i].content
                		+'<span class="gray9"> ('+data[i].createtime.substring(5,16)+')</span>'
                		+'</p>'
                	+'<div class="feed_att">';
               // if(!flag){html+='<a href="javascript:void(0);" onclick="App.reMsg(\'0o筱梦o0\',true)">回复</a>';}
           				html+='</div>'	
                	+'<div class="rd_br"></div>'
                	+'<div class="rd_bl"></div>'
            	+'</div>'
            	+'<div class="clear"></div>'
        		+'</li>';
        		if(username==''&&!flag){
        			username=data[i].username;
        		}
				rslHtml += html;
				j=data.length;
			}
			if(username==''){
				Jes.doQueryList('userinfo_query_sql@idx',{paraObj:"{userid:'" + ruserid +" '}"},function(data){
					username = data[0].username;
				})
			}
			Jes.html('msg_list',rslHtml);
			for(var i=0;i<j;i++){
				Jes.html('username'+i,username);
			}
			Jes.html('icon_send','发私信给:'+username);
			Jes.html('my_letter','我和“'+username+'”的对话');
		});
		}
	}
	//删除记录   为什么删除不成功？！？
	,del : function(sxId,obj){
		var el = obj.parentNode.parentNode;
		el.parentNode.removeChild(el);
		Jes.executeSql({ids:sxId,sql:'sixin_delete_hql'},function(){
			Jes.alert('删除成功');
		});
	}
	//回复私信
	,reMsg : function(loginid,ruserid){
		//Jes('fusename').value = loginid;
		Jes('fuserid').value = ruserid;
		showDiv(Jes('showDiv2'));
		//Jes('fusename').setAttribute('disabled', 'disabled');
	}
	//show
	,showDiv : function (obj){
		var pz = ___getPageSize(), ps = ___getPageScroll();
		var ow = $(obj).width(),oh = $(obj).height();
		$(obj).css({
			top:(pz[3]-oh)/2 + ps[1],
			left:(pz[2]-ow)/2 +ps[0]
		}).show();
	}
	//详情发送私信
	,doSend : function(){
		if(Jes('msg_editor').value==null||Jes('msg_editor').value==''){
			Jes.alert('填写私信内容'); return;
		}
		Jes.save('CnMsg',{param:{'fuserid':Jes.request('ruserid'),'content':Jes('msg_editor').value}},function(data){
			if(data==1){
				Jes.alert('发送成功');
				Cn_Sixin.queryView(Jes.request('ruserid'));
				Jes('msg_editor').value ='';
			}else{
				Jes.alert('发送失败')
			}
		})
	}
	//发送私信
	,send : function(){
		var fuserid = Jes('fuserid').value;
		var content = Jes('content').value;
		if(fuserid==null){Jes.alert("请填写发送对象");return;}
		Jes.save('CnMsg',{param:{'fuserid':fuserid,'content':content}},function(data){
			if(data==1){
				Jes.alert('发送成功');
				Jes.hide('showDiv1');
				Cn_Sixin.init();
			}else{
				Jes.alert('发送失败')
			}
		})
	}
	//验证发送人是否互相关注
	,userisable : function(){
		var fusername = Jes('fusename').value;
		if(fusername==null){Jes.alert("请填写发送对象");return;}
		Jes.doQueryList('sxuser_query_sql@user',{paraObj:"{fusername:'" + fusername +" '}"},function(data){
			if(data[0]==null){
				Jes.alert('私信只允许互相关注的人');
				Jes('fusename').value= "";
			}else{
				Jes('fuserid').value=data[0].fuserid;
			}
		});
	}
}
/** 
 *提到我的页面
 */
Cn_Myat ={
	init : function(){
		Cn_Index.rightInit();
		Cn_Myat.getMyat('feed_list');
	}
	,getMyat : function(el,page,pageSize){
		page = page || 1,pageSize = pageSize|| 15;
		Jes.page('myat_query_sql@idx',{page:page,pageSize:pageSize,isLoad:false},function(data){
			var html=[],_isW,actpro,da=data.pageList;
			Jes.html('numcounts',data.totalPages);
			Cn_Index._TOPICDATA = da;
			for(var i=0;i<da.length;i++){
				actpro='1';
				_isW = da[i].type==2?true:false;
				if(_isW) html.push(Comm._actHtml(da[i],i));
				else html.push(Comm._sayHtml(da[i],i));
			}
			Jes.html(el,html);
			var html = Jes.Page.html(data,'1');
			Jes.Page.fn['1'] = function(p){
				Cn_Index.getMyat(el,p,pageSize);
			}
			Jes.html('all_page',html);
		});
	}
}
//__________________________________________________附件通用代码begin________________________________________________________//
/**
 * 图片上传
 */
Jes.Upload = {
	//type 不同页面上传图片
	upload : function(type){
		if($("attachfile").value == ""){Jes.alert("上传海报不能为空！");return;}
		Jes('upform').submit();
		PIC_TYPE = type;
		//Jes.hide('attachfile');
		//Jes('attachfile').disabled=true;
	}
	,callBack : function(data){
		var el = Jes('upImg');
		try{
			var src = data.httppath+data.name;
			switch (PIC_TYPE)  {
				case 1 ://index.html
					Jes('topicpic').value=data.name;
					Jes.hide('topicfile');
					break;
				case 2 ://actview.html
					Jes('plfilename').value=data.name;
					Jes.hide('plfile');
					var image=new Image(),width,height;
		        	image.src = CONFIG_DATA.path + data.name;
		        	if(image.width>100||image.height>100){
						w=image.width/100;
						h=image.height/100;
						if(w>h){
							width=100;
							height=image.height/w;
						}else{
							height=100;
							width=image.width/h;
						}
					}else{ width=100,height=100}
					Jes.html('upImg','<img width="'+width+'" height="'+height+'" id="act_pic" src="'+src+'">'+
						'<textarea id="picremark" title="图片中都有谁,可以@他们描述下" value="图片中都有谁,可以@他们描述下"></textarea>'+
						'<p><input type="button" onclick="Cn_Index.uploadActpic();" value="确定"/>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:Jes.Upload.del();">删除图片</a></p>');
					break;
				default:
					if(Jes('actpic')!=null)Jes('actpic').value=data.name;
					if(Jes('pic')!=null)Jes('pic').value=data.name;
					var image=new Image(),width,height;
		        	image.src = CONFIG_DATA.path + data.name;
		        	if(image.width>100||image.height>100){
						w=image.width/100;
						h=image.height/100;
						if(w>h){
							width=100;
							height=image.height/w;
						}else{
							height=100;
							width=image.width/h;
						}
					}else{ width=100,height=100}
		        	Jes.html('upImg','<table><tr><td><img width="'+width+'" height="'+height+'" id="act_pic" src="'
		        		+src+'"></td><td><a style="color:red" href="javascript:Jes.Upload.del();">删除</a></td></tr></table>');
        			break;
			}
	    }catch(e){
			Jes.alert("获得附件信息失败，请联系管理员。");
		}
	}
	,dealimg : function(){
			var image=new Image(),width,height;
        	image.src = CONFIG_DATA.path + data.name;
        	if(image.width>130||image.height>130){
				w=image.width/130;
				h=image.height/130;
				if(w>h){
					width=130;
					height=image.height/w;
				}else{
					height=130;
					width=image.width/h;
				}
			}else{ width=130,height=130}
	}
	,del : function(){
		Jes.html('upImg','');
		//Jes('attachfile').disabled=false;
		Jes.show('attachfile');
		switch (PIC_TYPE)  {
			case '1' :
				Jes('topicpic').value='';
				$("topicfile").outerHTML  = $("attachfile").outerHTML;
				break;
			case '2' :
				Jes('plfilename').value='';
				$("topicfile").outerHTML  = $("attachfile").outerHTML;
				break;			
		}
		if(Jes('actpic')!=null)Jes('actpic').value='';
		if(Jes('pic')!=null)Jes('pic').value='';
		$("attachfile").outerHTML  = $("attachfile").outerHTML;
	}
	,drawImage : function(Img,WIDTH,HEIGHT){
		var image=new Image();
		image.src=Img.src;
		var width=WIDTH;//预先设置的所期望的宽的值
		var height=HEIGHT;//预先设置的所期望的高的值
		if(image.width>width||image.height>height){
			w=image.width/width;
			h=image.height/height;
			if(w>h){
				Img.width=width;
				Img.height=image.height/w;
			}else{
				Img.height=height;
				Img.width=image.width/h;
			}
		}
		return "1";
	}
}
//__________________________________________________附件通用代码end__________________________________________________________//